From b40ec48136c4ab92438e0591231303f07834a861 Mon Sep 17 00:00:00 2001 From: Boni Garcia Date: Tue, 24 Jul 2018 15:59:11 +0200 Subject: [PATCH] Download proper version of chromedriver --- docker/Emulator_x86 | 5 ++--- release.sh | 17 ++++++++++++++--- src/app.py | 3 +-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/docker/Emulator_x86 b/docker/Emulator_x86 index a30f489..b7d9f8e 100644 --- a/docker/Emulator_x86 +++ b/docker/Emulator_x86 @@ -89,20 +89,19 @@ ARG PROCESSOR=x86 ARG SYS_IMG=x86 ARG IMG_TYPE=google_apis ARG BROWSER=android -ARG CHROME_DRIVER=24 ENV ANDROID_VERSION=$ANDROID_VERSION \ API_LEVEL=$API_LEVEL \ PROCESSOR=$PROCESSOR \ SYS_IMG=$SYS_IMG \ IMG_TYPE=$IMG_TYPE \ BROWSER=$BROWSER \ - CHROME_DRIVER=2.40 + CHROME_DRIVER=$CHROME_DRIVER ENV PATH ${PATH}:${ANDROID_HOME}/build-tools RUN yes | sdkmanager --licenses && \ sdkmanager "platforms;android-${API_LEVEL}" "system-images;android-${API_LEVEL};${IMG_TYPE};${SYS_IMG}" "emulator" #============================================== -# Download latest version of chromedriver +# Download proper version of chromedriver # to be able to use Chrome browser in emulator #============================================== RUN wget -nv -O chrome.zip "https://chromedriver.storage.googleapis.com/${CHROME_DRIVER}/chromedriver_linux64.zip" \ diff --git a/release.sh b/release.sh index 25beda6..1d70186 100755 --- a/release.sh +++ b/release.sh @@ -31,6 +31,18 @@ declare -A list_of_levels=( [8.1]=27 ) +# The version of the Chrome browser installed on the Android emulator needs to be known beforehand +# in order to chose the proper version of chromedriver (see http://chromedriver.chromium.org/downloads) +declare -A chromedriver_versions=( + [5.0.1]="2.12" + [5.1.1]="2.13" + [6.0]="2.18" + [7.0]="2.23" + [7.1.1]="2.28" + [8.0]="2.31" + [8.1]="2.33" +) + function get_android_versions() { versions=() @@ -57,9 +69,6 @@ function get_android_versions() { get_android_versions processor=x86 -#chrome_driver=$(curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE) -#Reason: https://sites.google.com/a/chromium.org/chromedriver/downloads -chrome_driver=2.33 function test() { # Prepare needed parameter to run tests @@ -143,6 +152,8 @@ function build() { echo "[BUILD] API Level: $level" sys_img=$processor echo "[BUILD] System Image: $sys_img" + chrome_driver="${chromedriver_versions[$v]}" + echo "[BUILD] chromedriver version: $chrome_driver" image_version="$IMAGE-$processor-$v:$RELEASE" image_latest="$IMAGE-$processor-$v:latest" echo "[BUILD] Image name: $image_version and $image_latest" diff --git a/src/app.py b/src/app.py index df48f17..bf90d79 100644 --- a/src/app.py +++ b/src/app.py @@ -125,8 +125,7 @@ def appium_run(avd_name: str): cmd += ' --relaxed-security' default_web_browser = os.getenv('BROWSER') - if default_web_browser == 'chrome': - cmd += ' --chromedriver-executable {driver}'.format(driver=CHROME_DRIVER) + cmd += ' --chromedriver-executable {driver}'.format(driver=CHROME_DRIVER) grid_connect = convert_str_to_bool(str(os.getenv('CONNECT_TO_GRID', False))) logger.info('Connect to selenium grid? {connect}'.format(connect=grid_connect))