I'm new to robot framework and have been trying to run this script.
*** Settings ***
Library SeleniumLibrary run_on_failure=Nothing
Test Setup Open Browser And Go To Page
Test Teardown Close Browser
*** Variables ***
${FORM_URL} https://www.google.com/
${BROWSER} headlesschrome
*** Test Cases ***
Page Should Show Header
Page Should Contain Google
*** Keywords ***
Open Browser And Go To Page
Open Browser ${FORM_URL} ${BROWSER}
On running the script getting following error:
==============================================================================
Testing
==============================================================================
Page Should Show Header :: When visit the page it should show the ... | FAIL |
Setup failed:
WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
------------------------------------------------------------------------------
Testing | FAIL |
I've tried all the suggested answers on Stackoverflow and till it does'nt works.Tried these bellow and even added driver details on PATH but getting same error. Current google-chrome version is 96.0.4664 pip 21.3.1 Python 3.7.9
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
options.add_argument('--log-level=3')
driver = webdriver.Chrome(executable_path='D:\Users\win32\96.0.4664.45\chromedriver.exe', options=options)
CodePudding user response:
solution1: Go to Windows environment variables, add the PATH to the chromedriver.exe location to it.
solution2: drag the chromedriver.exe to the location where your .robot files are. (in VisualStudioCode you can drag from Windows FileExplorer to the location in the menu on the right).
advise: pip install webdrivermanager
read page: https://github.com/robotframework/SeleniumLibrary
CodePudding user response:
- Add Windows path "D:\Users\win32\96.0.4664.45\chromedriver.exe" to 'PATH' variable using Env variables click on OK. Try restarting eclipse and laptop/PC on setting up above stuff.
- Also, you can add chromedriver.exe to your Python path folder >> "...\Python\Python37-32\Scripts\chromedriver.exe"