Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set path chrome driver in robot framework?

Now, I set path variable

path  : D:..;C:\Program Files\Google\Chrome\Application
Chrome : C:\Program Files\Google\Chrome\Application\chromedriver.exe

I can call open Chrome in command line.

But error when run in RIDE

FAIL : WebDriverException: Message: unknown error: Chrome failed to start: crashed (Driver info: chromedriver=2.13.307647 (5a7d0541ebc58e69994a6fb2ed930f45261f3c29),platform=Windows NT 6.1 SP1 x86)

like image 449
Natchaya TingTang Avatar asked Feb 16 '15 08:02

Natchaya TingTang


People also ask

How do I give Chrome driver path to robot framework?

Creating script for search in google using robot framework, run on chrome browser. If chrome driver is not installed on your machine, then 'WebDriver Exception' throws as you have shown in above image. Then need to set up the chrome driver on your machine. Click on chromedriver.exe file and run.

How do I fix Chromedriver executable in path?

To solve the Selenium error "WebDriverException: Message: 'chromedriver' executable needs to be in PATH", install and import the webdriver-manager module by running pip install webdriver-manager . The module simplifies management of binary drivers for different browsers.


2 Answers

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  OperatingSystem
Suite Setup  Setup chromedriver
*** Keywords ****
Setup chromedriver
  Set Environment Variable  webdriver.chrome.driver  ${EXECDIR}/chromedriver.exe   
like image 186
Uri Shtand Avatar answered Sep 20 '22 16:09

Uri Shtand


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.

like image 24
Rahul Tiwari Avatar answered Sep 20 '22 16:09

Rahul Tiwari