- Какую версию chromedriver установить?
- Скачать ChromeDriver для Linux, Windows и Mac
- Установка ChromeDriver под Linux, Windows и Mac
- Chris Kenst
- Installing on macOS:
- Additional Resources
- diemol / chromedriver-install.sh
- This comment has been minimized.
- diemol commented Oct 9, 2017
- Disclaimer
- Downloads
- diemol / chromedriver-install.sh
- This comment has been minimized.
- diemol commented Oct 9, 2017
- Disclaimer
Для запуска тестов Selenium в Google Chrome, помимо самого браузера Chrome, должен быть установлен ChromeDriver. Установить ChromeDriver очень просто, так как он находится в свободном доступе в Интернете. Загрузите архив в зависимости от операционной системы, разархивируйте его и поместите исполняемый файл chromedriver в нужную директорию.
Какую версию chromedriver установить?
Мы должны установить именно ту версия которая была бы совместима с установленным Google Chrome на нашем ПК или VDS. В случае, если версии не совпадают, то мы получим данную ошибку:
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81
Введите в адресную строку Google Chrome данный путь:
У вас появится вот такое окно:
Рисунок 1 — Узнаем версию браузера Google Chrome
Скачать ChromeDriver для Linux, Windows и Mac
На данный момент актуальная версия драйвера 81.0.40 хотя у меня установлен более старый Google Chrome и последняя версия мне не подойдет. Как видно на рисунке выше, мне нужна версия 79.0.39 у вас может быть другая версия, нужно её скачать.
Рисунок 2 — Официальный сайт Google для загрузки драйвера chromedriver
На момент прочтения этой статьи версия может быть другой. Всегда выбирайте более новую версию, чтобы не поймать старые баги которые уже давно исправили в новой версии. НО! Помните, что вам нужно обновить и свой браузер Google Chrome если вы хотите работать с новой версией ChromeDriver.
Установка ChromeDriver под Linux, Windows и Mac
- Заходим на сайт https://chromedriver.storage.googleapis.com/index.html?path=79.0.3945.36/ (Проверьте сайт с Рис. 2 на обновления, тут версия: 79.0.3945);
- Скачиваем архив под вашу операционную систему;
- Распаковываем файл и запоминаем где находится файл chromedriver или chromedriver.exe (Windows).
Рисунок 3 — Скаченный архив с ChromeDriver
Если у вас Linux дистрибутив или Mac, вам нужно дать файлу chromedriver нужные права на выполнения. Открываем терминал и вводим команды одна за другой.
Источник
Chris Kenst
The ChromeDriver getting started guide isn’t super helpful if you are unfamiliar with including the ChromeDriver location in your PATH environment variable. (The PATH variable helps Chrome find the downloaded ChromeDriver exe). Also it’s a lot of work for something so common. Never fear, here is a better way:
Installing on macOS:
Listed in order of easiest to hardest install, these are the best ways to install ChromeDriver on a Mac:
- The easiest way to install ChromeDriver is to use your package manager such as brew or npm to install the driver.
- In your terminal window with the Homebrew package manager:
- Install ChromeDriver with brew install cask chromedriver
- Confirm it was installed using chromedriver —version and seeing it returns a version. If it errors it wasn’t installed
- Other package managers like npm have similar commands npm install chromedriver
- In your terminal window with the Homebrew package manager:
- Run Chrome & ChromeDriver in a container using Docker. Simply download the combined container, start it and point your code at the right address.
- Specify it in your Selenium setup code and check it into source control like any other configuration detail. If you go this route, you can include additional drivers like GeckoDriver (aka Firefox) as well.
- Download the driver and add its location to your System PATH.
Which methods have you found the easiest or most success with? Which methods didn’t work for you? Please leave a comment below.
Additional Resources
Oh and if this article worked for you please consider sharing it or buying me coffee to say thanks.
Источник
diemol / chromedriver-install.sh
#! /bin/bash |
# download and install latest chromedriver for linux or mac. |
# required for selenium to drive a Chrome browser. |
install_dir= » /usr/local/bin « |
version= $( wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE ) |
if [[ $( uname ) == » Darwin » ]] ; then |
url=https://chromedriver.storage.googleapis.com/ $version /chromedriver_mac64.zip |
elif [[ $( uname ) == » Linux » ]] ; then |
url=https://chromedriver.storage.googleapis.com/ $version /chromedriver_linux64.zip |
else |
echo » can’t determine OS « |
exit 1 |
fi |
curl -s -L » $url » | tar -xz |
chmod +x chromedriver |
sudo mv chromedriver » $install_dir « |
echo » installed chromedriver binary in $install_dir « |
#! /bin/bash |
# download and install latest geckodriver for linux or mac. |
# required for selenium to drive a firefox browser. |
install_dir= » /usr/local/bin « |
json= $( curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest ) |
if [[ $( uname ) == » Darwin » ]] ; then |
url= $( echo » $json » | jq -r ‘ .assets[].browser_download_url | select(contains(«macos»)) ‘ ) |
elif [[ $( uname ) == » Linux » ]] ; then |
url= $( echo » $json » | jq -r ‘ .assets[].browser_download_url | select(contains(«linux64»)) ‘ ) |
else |
echo » can’t determine OS « |
exit 1 |
fi |
curl -s -L » $url » | tar -xz |
chmod +x geckodriver |
sudo mv geckodriver » $install_dir « |
echo » installed geckodriver binary in $install_dir « |
This comment has been minimized.
Copy link Quote reply
diemol commented Oct 9, 2017
Disclaimer
This Firefox/Geckodriver script was taken from https://gist.github.com/cgoldberg/4097efbfeb40adf698a7d05e75e0ff51, and the Chromedriver is basically a copy of it
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник
Downloads
If you are using Chrome version 9 5 , please download ChromeDriver 95.0.4638.17
If you are using Chrome version 9 4 , please download ChromeDriver 94.0.4606.61
If you are using Chrome version 9 3 , please download ChromeDriver 93.0.4577.63
For older version of Chrome, please see below for the version of ChromeDriver that supports it.
If you are using Chrome from Dev or Canary channel, please following instructions on the ChromeDriver Canary page.
For more information on selecting the right version of ChromeDriver, please see the Version Selection page.
Supports Chrome version 95
Resolved issue 3857: Host header or origin header is specified and is not whitelisted or localhost [Pri-1]
Added ` —allowed-origins ` argument
For more details, please see the release notes .
Supports Chrome version 9 5
Resolved issue 3857: Host header or origin header is specified and is not whitelisted or localhost [Pri-1]
Added ` —allowed-origins ` argument
For more details, please see the release notes .
Supports Chrome version 94
For more details, please see the release notes .
Supports Chrome version 9 4
For more details, please see the release notes .
Supports Chrome version 93
For more details, please see the release notes .
Supports Chrome version 9 3
For more details, please see the release notes .
Supports Chrome version 92
For more details, please see the release notes .
Supports Chrome version 9 2
Resolved issue 3389: Host validation for ChromeDriver requests
For more details, please see the release notes .
Supports Chrome version 91
Resolved issue 1205107 : Unable to get attribute value for fields on the web application.
For more details, please see the release notes .
Supports Chrome version 91
Resolved issue 3744: SendKeys() and Click() silently fail after link navigation
Resolved issue 3746: attribute endpoint incorrectly updates values
For more details, please see the release notes .
Supports Chrome version 90
Resolved issue 3708: GetElementLocation’s inView fails for elements in shadow DOM
Resolved issue 3721: Collect performance log for service worker when enabled
Resolved issue 3731: AdbImpl::GetPidByName does not work correctly on non-standard Android OS’s like on OnePlus
Resolved issue 3733: Catastrophic failure with domain on localhost
Resolved issue 3734: Driver should Error Attempting to set Cookie on Wrong Domain
Resolved issue 3743: Refactor call function and fix remove element issue
For more details, please see the release notes .
Supports Chrome version 89
Resolved issue 3667: Timed out receiving a message from renderer
Resolved issue 3675: GetElementLocation uses inView method which mishandles boolean as array
Resolved issue 3682: GetElementRegion returns incorrect size for elements which are partially out of viewport
Resolved issue 3690: ChromeDriver fails if extensions use chrome.windows API
For more details, please see the release notes .
Supports Chrome version 88
Resolved issue 3641: Page not getting loaded/rendered when browser window is not in focus with Chrome Beta v87 and chromedriver v(87/86)
For more details, please see the release notes .
Supports Chrome version 88
Resolved issue 3611: getText() output in protractor different from .innerText
Resolved issue 3625: Improve element screenshot compatibility
Resolved issue 3628: Stale Element Reference and wrong URL reported back with URL having another URL as part of its path
Resolved issue 3631: Add support for the `webauthn:extension:largeBlob` capability
Resolved issue 3635: Chromedriver 86 — chromedriver .quit() doesn’t seem to pass unload event properly
Resolved issue 3649: Copying selected text to clipboard does not work on Windows 10 when using headless mode
For more details, please see the release notes .
Supports Chrome version 87
Resolved issue 3641: Page not getting loaded/rendered when browser window is not in focus with Chrome Beta v87 and chromedriver v(87/86)
Resolved issue 3657: Screenshot background browser timed out
For more details, please see the release notes .
Supports Chrome version 87
Resolved issue 2421: Delete old port-forwarding channels on android adb-server
Resolved issue 3474: Emulated mobile device list needs updating
Resolved issue 3507: Implement «get computed role»
Resolved issue 3508: Implement «get computed label»
Resolved issue 3584: Rename ChromeDriver command line option —whitelisted-ips
Resolved issue 3588: Bidi WebSocket connection
Resolved issue 3594: Navigation completes prematurely if OOPIF loads before main page
Resolved issue 3598: A command line option for devtools port to be forwarded to webview_devtools_remote socket
Resolved issue 3608: Chromedriver debuggerAddress does not support ipv6
For more details, please see the release notes .
Supports Chrome version 86
Resolved issue 3370: Shut down Chrome gracefully or cookie will not be correctly saved to SQLite persistence file
Resolved issue 3401: Get Element Location JS does not locate the visible center of the element
Resolved issue 3462: For sendKeys, CMD key don’t work for MAC
Resolved issue 3541: Improve log between Client and ChromeDriver
Resolved issue 3559: Output Chrome version when ChromeDriver reports incompatible
For more details, please see the release notes .
Supports Chrome version 85
Resolved issue 3578: Chrome 85 no longer allows graceful interaction with windows when an alert dialog is open
For more details, please see the release notes .
Supports Chrome version 85
Resolved issue 3577: ChromeDriver 85 does not detect changed Chrome directory (C:\Program Files)
For more details, please see the release notes .
Supports Chrome version 85
Resolved issue 3214: ChromeDriver78: Sendkeys resets text selection with contenteditable
Resolved issue 3376: Remove LaunchApp command from ChromeDriver
Resolved issue 3432: Sometimes NavigationTracker fails to detect when the page has finished loading
Resolved issue 3481: New Print endpoint according to w3c spec
Resolved issue 3488: driver.get doesn’t throw error when proxy is wrong configured
Resolved issue 3502: Use document.hasFocus() to check if element is focused
Resolved issue 3515: selenium.common.exceptions.WebDriverException: Message: unknown error: bad inspector message
For more details, please see the release notes .
Источник
diemol / chromedriver-install.sh
#! /bin/bash |
# download and install latest chromedriver for linux or mac. |
# required for selenium to drive a Chrome browser. |
install_dir= » /usr/local/bin « |
version= $( wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE ) |
if [[ $( uname ) == » Darwin » ]] ; then |
url=https://chromedriver.storage.googleapis.com/ $version /chromedriver_mac64.zip |
elif [[ $( uname ) == » Linux » ]] ; then |
url=https://chromedriver.storage.googleapis.com/ $version /chromedriver_linux64.zip |
else |
echo » can’t determine OS « |
exit 1 |
fi |
curl -s -L » $url » | tar -xz |
chmod +x chromedriver |
sudo mv chromedriver » $install_dir « |
echo » installed chromedriver binary in $install_dir « |
#! /bin/bash |
# download and install latest geckodriver for linux or mac. |
# required for selenium to drive a firefox browser. |
install_dir= » /usr/local/bin « |
json= $( curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest ) |
if [[ $( uname ) == » Darwin » ]] ; then |
url= $( echo » $json » | jq -r ‘ .assets[].browser_download_url | select(contains(«macos»)) ‘ ) |
elif [[ $( uname ) == » Linux » ]] ; then |
url= $( echo » $json » | jq -r ‘ .assets[].browser_download_url | select(contains(«linux64»)) ‘ ) |
else |
echo » can’t determine OS « |
exit 1 |
fi |
curl -s -L » $url » | tar -xz |
chmod +x geckodriver |
sudo mv geckodriver » $install_dir « |
echo » installed geckodriver binary in $install_dir « |
This comment has been minimized.
Copy link Quote reply
diemol commented Oct 9, 2017
Disclaimer
This Firefox/Geckodriver script was taken from https://gist.github.com/cgoldberg/4097efbfeb40adf698a7d05e75e0ff51, and the Chromedriver is basically a copy of it
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник