Download proper version of chromedriver

This commit is contained in:
Boni Garcia 2018-07-24 15:59:11 +02:00
parent 064331de0e
commit b40ec48136
3 changed files with 17 additions and 8 deletions

View file

@ -89,20 +89,19 @@ ARG PROCESSOR=x86
ARG SYS_IMG=x86 ARG SYS_IMG=x86
ARG IMG_TYPE=google_apis ARG IMG_TYPE=google_apis
ARG BROWSER=android ARG BROWSER=android
ARG CHROME_DRIVER=24
ENV ANDROID_VERSION=$ANDROID_VERSION \ ENV ANDROID_VERSION=$ANDROID_VERSION \
API_LEVEL=$API_LEVEL \ API_LEVEL=$API_LEVEL \
PROCESSOR=$PROCESSOR \ PROCESSOR=$PROCESSOR \
SYS_IMG=$SYS_IMG \ SYS_IMG=$SYS_IMG \
IMG_TYPE=$IMG_TYPE \ IMG_TYPE=$IMG_TYPE \
BROWSER=$BROWSER \ BROWSER=$BROWSER \
CHROME_DRIVER=2.40 CHROME_DRIVER=$CHROME_DRIVER
ENV PATH ${PATH}:${ANDROID_HOME}/build-tools ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
RUN yes | sdkmanager --licenses && \ RUN yes | sdkmanager --licenses && \
sdkmanager "platforms;android-${API_LEVEL}" "system-images;android-${API_LEVEL};${IMG_TYPE};${SYS_IMG}" "emulator" 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 # 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" \ RUN wget -nv -O chrome.zip "https://chromedriver.storage.googleapis.com/${CHROME_DRIVER}/chromedriver_linux64.zip" \

View file

@ -31,6 +31,18 @@ declare -A list_of_levels=(
[8.1]=27 [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() { function get_android_versions() {
versions=() versions=()
@ -57,9 +69,6 @@ function get_android_versions() {
get_android_versions get_android_versions
processor=x86 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() { function test() {
# Prepare needed parameter to run tests # Prepare needed parameter to run tests
@ -143,6 +152,8 @@ function build() {
echo "[BUILD] API Level: $level" echo "[BUILD] API Level: $level"
sys_img=$processor sys_img=$processor
echo "[BUILD] System Image: $sys_img" echo "[BUILD] System Image: $sys_img"
chrome_driver="${chromedriver_versions[$v]}"
echo "[BUILD] chromedriver version: $chrome_driver"
image_version="$IMAGE-$processor-$v:$RELEASE" image_version="$IMAGE-$processor-$v:$RELEASE"
image_latest="$IMAGE-$processor-$v:latest" image_latest="$IMAGE-$processor-$v:latest"
echo "[BUILD] Image name: $image_version and $image_latest" echo "[BUILD] Image name: $image_version and $image_latest"

View file

@ -125,7 +125,6 @@ def appium_run(avd_name: str):
cmd += ' --relaxed-security' cmd += ' --relaxed-security'
default_web_browser = os.getenv('BROWSER') 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))) grid_connect = convert_str_to_bool(str(os.getenv('CONNECT_TO_GRID', False)))