unable to connect to chromedriver http://127.0.0.1

2020-02-12 16:27发布

I get this error when I run my cucumber tests:

"*Unable to either launch or connect to Chrome. Please check that ChromeDriver is up-to-date. Using Chrome binary at: /opt/google/chrome/google-chrome (Selenium::WebDriver::Error::UnknownError) *"

I downloaded the chromdriver, unzip it, copy it to the path (/opt/google/chrome/google-chrome ) and sudo chmod +x /opt/google/chrome/google-chrome.

which google-chrome : /usr/bin/google-chrome

which chromedriver : /usr/share/ruby-rvm/gems/ruby-1.9.2-p318/bin/chromedriver

capybara (1.1.2)

cucumber (0.9.4)

cucumber-rails (0.3.2)

selenium-webdriver (2.20.0)

I searched my error but none of the answers worked for me! When I run my test I do not see chrome starts!

I really dont know what is wrong! I tried two different versions of chromedriver!

Jenkins should run/executes my tests in CI.The tests work when you run them but not when Jenkins runs them? I could run them by another user and then I installed jenkins and I get this error. I get the same error when I run my tests in terminal at terminal as well.Did you read https://wiki.jenkins-ci.org/display/JENKINS/My+software+builds+on+my+computer+but+not+on+Jenkins ? I couldnt find much about my problem here. xvfb: I installed the plugin in the jenkins but in the build environment if I click "run xvfb before the build and shut it down after", I get this error: "FATAL: null java.lang.NullPointerException"

4条回答
劫难
2楼-- · 2020-02-12 16:39

Finally I found the answer:

if you want to run GUI tests on Jenkins CI running on Windows do not configure it as a windows service instead run it from the command prompt or set it up as a scheduled task to run on windows logon using the command “java -jar jenkins.war”

taken from this article

查看更多
欢心
3楼-- · 2020-02-12 16:41

chromedriver can be installed in two ways: downloading, decompressing the zip and putting the file in "/usr/bin" or adding the "chromedriver-helper" gem in your Gemfile.

Choose one or another way because doing both many time it causes problems. If you are installing chromedriver from google, be sure to uninstall the gem:

gem uninstall chromedriver-helper 

and be sure chromedriver is in your path:

which chromedriver 
查看更多
迷人小祖宗
5楼-- · 2020-02-12 16:45

Please provide more details. How does this question relate to Jenkins? Is Jenkins executing the tests? The tests work when you run them but not when Jenkins runs them? You do not go so far as to say that out loud, but I will assume it because it is what people usually need help with.

Did you read https://wiki.jenkins-ci.org/display/JENKINS/My+software+builds+on+my+computer+but+not+on+Jenkins ?

If you are executing Chrome inside a Jenkins job, do you have something like https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin or https://wiki.jenkins-ci.org/display/JENKINS/Xvnc+Plugin installed?

查看更多
登录 后发表回答