How to set path chrome driver in robot framework? How to set path chrome driver in robot framework? google-chrome google-chrome

How to set path chrome driver in robot framework?


You need chromeDriver not Chrome.Start by downloading the chrome driver.

https://sites.google.com/a/chromium.org/chromedriver/downloads

Put it somewhere that your test can access (for example a bin folder relative to your tests).

Now you need to set the environment variable to point the chrome driver.

You can do it from outside the test (for example, as a global setting for your desktop), or from your test setup.

From outside the test

Just set the environment variable webdriver.chrome.driver to point the executable.

(Control Panel -> System -> Edit the system environment variables)

From inside the test

If you're using jython, you need to create a small java library to do that for you

public void setSystemProperty(String key, String value) {    System.getProperties().setProperty(key,value);}

And use it from your test

Prepare Selenium Driver  Set System Property  webdriver.chrome.driver    ${EXECDIR}/chromedriver.exe

If you're using Python, you can use the OperatingSystem library

*** Settings ***Library  OperatingSystemSuite Setup  Setup chromedriver*** Keywords ****Setup chromedriver  Set Environment Variable  webdriver.chrome.driver  ${EXECDIR}/chromedriver.exe   


Download Chromedriver.exe from its official website and keep this .exe file in 'C:\Python27\Scripts' directory.Now mention this path as your environment variable eg. C:\Python27\Scripts\chromedriver.exe Now Restart your computer and execute your test case.


In case you need to run your tests against a specific browser version, e.g. because your customers have a managed environment and all use the same browser version at a time, you can maintain the browser drivers in your source code repository and add the respective folder to the PATH during test execution.

My acceptance test folder 'atest' contains a 'bin' folder which contains the browser drivers:

atest  bin    chromedriver.exe    geckodriver.exe    ...

Now I can add it to the PATH variable during Suite Setup:

*** Settings ***Library          OperatingSystemSuite Setup      Include Browser Drivers*** Keywords ***Include Browser Drivers    Append To Environment Variable    PATH    ${EXECDIR}/bin