How to set up Selenium with Chromedriver on Jenkins-hosted Grid

前端 未结 4 800
一生所求
一生所求 2020-12-20 00:30

I just make my frist steps with Selenium. I successfully set up a test (Firefox driver), running on Selenium grid on my Jenkins (using Jenkins-Selenium-Grid plugin). I also

相关标签:
4条回答
  • 2020-12-20 00:49

    I asked the same question in selenium group:

    https://groups.google.com/forum/?fromgroups#!topic/selenium-users/-3LJ3wma3RE

    the solution provided there didn't work for me but probably it works for you? (set PATH for chromedriver on jenkins)

    0 讨论(0)
  • 2020-12-20 00:58

    You can use this as a node setup code:

    java -jar selenium-server-standalone-2.19.0.jar -Dwebdriver.chrome.driver="C:\Java\chromedriver.exe" -role node -hub http://localhost:4444/grid/register -browser "browserName=internet explorer,version=8,platform=WINDOWS" -browser "browserName=chrome,version=17,platform=WINDOWS" -browser "browserName=firefox,version=9,platform=WINDOWS" -browser "browserName=opera,version=11,platform=WINDOWS"

    So there is direct point to chromedriver binary and it is a chromedriver.exe not the common chrome.exe. I had similar problem and it worked for me.

    0 讨论(0)
  • 2020-12-20 01:02

    Did you specify the -Dwebdriver.chrome.driver=Path/To/ChromeDriver when starting your node?

    Adding this may help.

    0 讨论(0)
  • 2020-12-20 01:04

    Just went through the same process myself.

    Using Selenium Plugin you can set up the selenium grid.
    Using Chromedriver Plugin you can have chrome driver automatically installed.
    Using Selenium Axis Plugin you can create matrix jobs.

    First time installation issue After installing the Chromedriver plugin it can take a few minutes to download and be ready after it is automatically installed. It can be that the slaves try and install the chromedriver before master is fully installed and so fail to lookup the download location. Restarting the slaves will cause it to try again and install the chromedriver on the slaves.

    On each slave and the master you should finally end up with a $JENKINS_HOME\tools\chromedriver\chromedrive.exe which you can refer to in the Jenkins Selenium plugin configuration for Chrome[driver] binary path as tools\chromedrive\chromedriver.exe and Jenkins will prepend the slave specific $JENKINS_HOME for you. Jenkins Selenium Config

    Installed Chrome to the default location which turned out to be C:\Program Files (x86)\Google\Chrome\Application\chrome.exe same as described.

    At this point I could run a test job succesfully without the error you have shown.

    DesiredCapabilities capability = DesiredCapabilities.chrome();
    WebDriver driver = new RemoteWebDriver(new URL("http://Jenkins.ip.here:4444/wd/hub"), capability);
    driver.get(siteBase.toString());
    String page = driver.getPageSource();
    

    So some other things to consider

    • having changed jenkins selenium config, did you restart selenium service, after config change it appears to stop them. Does the config have instances specified.
    • if it was an install location issue, you might be able to change the install location options in the test cases using

      ChromeOptions options = new ChromeOptions();
      options.setBinary("/path/to/other/chrome/binary");
      
    0 讨论(0)
提交回复
热议问题