How to: Установка chromedriver руками

Привет, сегодня поговорим, как установить ChromeDriver без костылей и ошибок.

Если автоматическая загрузка актуальной версии chromedriver (или драйвера для другого браузера) не предусмотрена. Или не работает, и мы при запуске UI-тестов получаем ошибку о том:

1.      Что у нас отсутствует chromedriver

2.      Не совпадает версия chromedriver и chrome (также может относиться к любому другому браузеру и его драйверу)

Скачиваем соответствующую версию chromedriver — https://googlechromelabs.github.io/chrome-for-testing/#stable

На Linux

  1. Распаковываем скаченный архив

  2. Переходим в каталог /usr/bin

  3. Удаляем старую версию chromedriver

    1389389a4f0f456ae7a84235df45d2d0.png

sudo rm chromedriver

  • Перемещаем в /usr/bin скаченный и распакованный новый chromedriver

sudo mv Downloads/chromedriver-linux64/chromedriver /usr/bin/

На Windows

  1. Распаковываем скаченный архив

  2. Перемещаем chromedriver в желаемую папку

  3. Прописываем системный путь к ней:

Step #4: Add ChromeDriver to System Path (Windows) 

  • Right-click your desktop«s «This PC» or «My Computer» icon.

  • Select »Properties» from the context menu.

  • Click on »Advanced system settings» on the left sidebar.

  • In the System Properties window, click the »Environment Variables» button.

  • In the »System Variables» section, scroll down and find the «Path» variable**.**

  • Click »Edit» or «New» to add a new entry.

  • Enter the path to the folder where you saved the ChromeDriver executable file (e.g., C:\path\to\chromedriver).

  • Click »OK» to save the changes.

Step #5: Verify ChromeDriver Installation 

  • Open a command prompt or terminal window.

  • Type the following command and press Enter.

chromedriver --version

Удачных тестов!

Habrahabr.ru прочитано 6047 раз