- Chris Kenst
- Installing on macOS:
- Additional Resources
- Downloads
- Какую версию chromedriver установить?
- Скачать ChromeDriver для Linux, Windows и Mac
- Установка ChromeDriver под Linux, Windows и Mac
- diemol / chromedriver-install.sh
- This comment has been minimized.
- diemol commented Oct 9, 2017
- Disclaimer
- Update chromedriver mac os
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.
Источник
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 .
Источник
Для запуска тестов 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 нужные права на выполнения. Открываем терминал и вводим команды одна за другой.
Источник
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.
Источник
Update chromedriver mac os
An NPM wrapper for Selenium ChromeDriver.
Building and Installing
Or grab the source and
What this is really doing is just grabbing a particular «blessed» (by this module) version of ChromeDriver. As new versions are released and vetted, this module will be updated accordingly.
The package has been set up to fetch and run ChromeDriver for MacOS (darwin), Linux based platforms (as identified by Node.js), and Windows. If you spot any platform weirdness, let us know or send a patch.
By default this package, when installed, will search for an existing Chromedriver binary in your configured temp directory. If found, and it is the correct version, it will simply copy it to your node_modules directory. You can force it always download by configuring it:
Or add property into your .npmrc file.
Another option is to use PATH variable CHROMEDRIVER_FORCE_DOWNLOAD .
Custom binaries url
To use a mirror of the ChromeDriver binaries use npm config property chromedriver_cdnurl . Default is https://chromedriver.storage.googleapis.com .
Or add property into your .npmrc file.
Another option is to use PATH variable CHROMEDRIVER_CDNURL .
Custom binaries file
To get the chromedriver from the filesystem instead of a web request use the npm config property chromedriver_filepath .
Or add property into your .npmrc file.
Another option is to use the PATH variable CHROMEDRIVER_FILEPATH
This variable can be used to set either a .zip file or the binary itself, eg:
Custom download options
Install through a proxy.
Use different User-Agent.
Skipping chromedriver download
You may wish to skip the downloading of the chromedriver binary file, for example if you know for certain that it is already there or if you want to use a system binary and just use this module as an interface to interact with it.
To achieve this you can use the npm config property chromedriver_skip_download .
Or add property into your .npmrc file.
Another option is to use the PATH variable CHROMEDRIVER_SKIP_DOWNLOAD
And npm will install a link to the binary in node_modules/.bin as it is wont to do.
Running with Selenium WebDriver
(Tested for selenium-webdriver version 2.48.2 )
The path will be added to the process automatically, you don’t need to configure it. But you can get it from require(‘chromedriver’).path if you want it.
Running via node
The package exports a path string that contains the path to the chromedriver binary/executable.
Below is an example of using this package via node.
You can also use the start and stop methods:
With the latest version, you can optionally receive a Promise from the chromedriver.start function:
Note: if your tests are ran asynchronously, chromedriver.stop() will have to be executed as a callback at the end of your tests
The NPM package version tracks the version of chromedriver that will be installed, with an additional build number that is used for revisions to the installer. You can use the package version number to install a specific version, or use the setting to a specific version. If there is a new Chromedriver version available which is not yet available as a version of node-chromedriver , the npm command npm run update-chromedriver in this repository can be used to make the required updates to this module, please submit the change as a PR. To always install the latest version of Chromedriver, use LATEST as the version number:
Or add property into your .npmrc file.
Another option is to use env variable CHROMEDRIVER_VERSION .
You can force the latest release for a specific major version by specifying LATEST_
You can also force a different version of chromedriver by replacing LATEST with a version number:
Detect ChromeDriver Version
The NPM package version may not be always compatible to your Chrome version. To get the chromedriver that corresponds to the version of Chrome installed, you can use the npm config property detect_chromedriver_version .
Or add property into your .npmrc file.
Another option is to use environment variable DETECT_CHROMEDRIVER_VERSION .
Note: When the property detect_chromedriver_version is provided, chromedriver_version and chromedriver_filepath properties are ignored.
A Note on chromedriver
Chromedriver is not a library for NodeJS.
This is an NPM wrapper and can be used to conveniently make ChromeDriver available. It is not a Node.js wrapper.
Supported Node.js versions
We will do our best to support every supported Node.js versions. See nodejs/Release for the current supported versions. You can also view our build scripts and check the versions there.
Questions, comments, bug reports, and pull requests are all welcome. Submit them at the project on GitHub.
Bug reports that include steps-to-reproduce (including code) are the best. Even better, make them in the form of pull requests.
We have added VS Code Remote support with containers. If you are on Windows, set git config core.autocrlf input so you don’t get git errors.
Thanks for Obvious and their PhantomJS project for heavy inspiration! Check their project on Github.
Licensed under the Apache License, Version 2.0.
Источник