Using Chrome Driver with Selenium 2

前端 未结 7 1299
情深已故
情深已故 2020-12-28 16:30

I\'m trying to use Chrome Drive to execute some of my tests, which are working perfectly with Firefox, but I\'m not being able to execute them, I\'m already verified the req

相关标签:
7条回答
  • 2020-12-28 17:13

    Have you made sure that you have downloaded the Chrome driver from http://code.google.com/p/selenium/downloads/list and placed it in your PATH?

    have a look at http://code.google.com/p/selenium/wiki/ChromeDriver for more details

    0 讨论(0)
  • 2020-12-28 17:14

    You can set the capabilities to point to the binary of the browser to be launched.

    DesiredCapabilities capabilities = DesiredCapabilities.chrome(); capabilities.setCapability("chrome.binary", "/usr/lib/chromium-browser/chromium-browser");

    WebDriver driver = new ChromeDriver(capabilities);

    For ex:- Chromium Browser(33.0.1729.0 )works fine with ChromeDriver 2.7 and not the with the older ones.

    You can choose from all the chromedriver version available from the link below:- http://chromedriver.storage.googleapis.com/index.html

    So try to use the browser version supported by the chromedriver.

    0 讨论(0)
  • 2020-12-28 17:17

    Just download the chromedriver_win32_13.0.775.0.zip and selenium-server-standalone-2.0rc3.jar from [http://code.google.com/p/selenium/downloads/list][1]

    Unzip the chromedriver_win32_13.0.775.0.zip into a folder, Eg. C:/drivers/chrome/, so that the chromedriver.exe is located at C:/drivers/chrome/chromedriver.exe.

    Register the node against the hub on port 6668 (for example)

    java -jar selenium-server-standalone-2.0rc3.jar -role webdriver -hub http://hubUrlHostname:4444/grid/register -port 6668 -browser "browserName=chrome,version=13.0,platform=windows" -Dwebdriver.chrome.driver=C:\drivers\chrome\chromedriver.exe
    

    If you access to

    http://hubUrlHostname:4444/grid/console

    you should see the Chrome driver registered.

    0 讨论(0)
  • 2020-12-28 17:17

    If you are using Maven Project. Follow the below steps

    1. Download the latest chromedriver.exe from this link.
    2. Create a drivers folder in test. It should look like this src/test/resources/drivers
    3. Move the chromedriver.exe to the above path in step 2
    4. Use the below code for before creating chrome driver object

    System.setProperty("webdriver.chrome.driver", Thread.currentThread().getContextClassLoader().getResource("drivers/chromedriver.exe").getFile());

    0 讨论(0)
  • 2020-12-28 17:24

    I was able to get this to work by launching the selenium server like this:

    java -jar selenium-server-standalone-2.0rc2.jar -Dwebdriver.chrome.driver=c:\path\to\chromedriver.exe
    

    (Running Windows 7 64bit, Chrome 12, selenium server rc2)

    0 讨论(0)
  • 2020-12-28 17:27

    Download the ChromeDriver.exe from http://code.google.com/p/selenium/downloads/list then add the system property like so:

    System.setProperty("webdriver.chrome.driver", "...\chromedriver.exe");
    
    0 讨论(0)
提交回复
热议问题