Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit e9f4ec8

Browse files
LctrsOndraM
authored andcommitted
Download a compatible version of chromedriver with chrome
Following the [algorithm described on the official chromedriver website](https://chromedriver.chromium.org/downloads/version-selection) : > Here are the steps to select the version of ChromeDriver to download: > > - First, find out which version of Chrome you are using. Let's say you have Chrome 72.0.3626.81. > - Take the Chrome version number, remove the last part, and append the result to URL "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_". For example, with Chrome version 72.0.3626.81, you'd get a URL "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_72.0.3626". > - Use the URL created in the last step to retrieve a small file containing the version of ChromeDriver to use. For example, the above URL will get your a file containing "72.0.3626.69". (The actual number may change in the future, of course.) > - Use the version number retrieved from the previous step to construct the URL to download ChromeDriver. With version 72.0.3626.69, the URL would be "https://chromedriver.storage.googleapis.com/index.html?path=72.0.3626.69/".
1 parent 212ab1f commit e9f4ec8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,13 @@ install:
134134
- travis_retry composer update --no-interaction $DEPENDENCIES
135135

136136
before_script:
137-
- if [ "$BROWSER_NAME" = "chrome" ]; then mkdir chromedriver; CHROMEDRIVER_VERSION=$(wget -qO- "https://chromedriver.storage.googleapis.com/LATEST_RELEASE"); wget -q -t 3 https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip; unzip chromedriver_linux64 -d chromedriver; fi
137+
- if [ "$BROWSER_NAME" = "chrome" ]; then
138+
mkdir chromedriver;
139+
CHROME_VERSION=$(google-chrome --product-version);
140+
CHROME_VERSION=${CHROME_VERSION%.*};
141+
wget -q -t 3 https://chromedriver.storage.googleapis.com/$(curl -L https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION})/chromedriver_linux64.zip;
142+
unzip chromedriver_linux64.zip -d chromedriver;
143+
fi
138144
- if [ "$BROWSER_NAME" = "chrome" ]; then export CHROMEDRIVER_PATH=$PWD/chromedriver/chromedriver; fi
139145
- if [ "$GECKODRIVER" = "1" ]; then mkdir -p geckodriver; wget -q -t 3 https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz; tar xzf geckodriver-v0.26.0-linux64.tar.gz -C geckodriver; fi
140146
- sh -e /etc/init.d/xvfb start # TODO: start only when needed (ie. not in headless mode)

0 commit comments

Comments
 (0)