Привет, сегодня поговорим, как установить ChromeDriver без костылей и ошибок.
Если автоматическая загрузка актуальной версии chromedriver (или драйвера для другого браузера) не предусмотрена. Или не работает, и мы при запуске UI-тестов получаем ошибку о том:
1. Что у нас отсутствует chromedriver
2. Не совпадает версия chromedriver и chrome (также может относиться к любому другому браузеру и его драйверу)
Скачиваем соответствующую версию chromedriver — https://googlechromelabs.github.io/chrome-for-testing/#stable
На Linux
-
Распаковываем скаченный архив
-
Переходим в каталог /usr/bin
-
Удаляем старую версию chromedriver
sudo rm chromedriver |
-
Перемещаем в /usr/bin скаченный и распакованный новый chromedriver
sudo mv Downloads/chromedriver-linux64/chromedriver /usr/bin/ |
На Windows
-
Распаковываем скаченный архив
-
Перемещаем chromedriver в желаемую папку
-
Прописываем системный путь к ней:
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 |
Удачных тестов!
ссылка на оригинал статьи https://habr.com/ru/articles/898386/
Добавить комментарий