Chromedriver crashes when lauched from watir-webdriver - watir

I have the following gems and I also have the latest Chrome driver 2.9 version.
builder (2.1.2)
bundler (1.6.0.pre.2)
childprocess (0.4.1)
coderay (1.1.0)
cucumber (0.8.7)
data_magic (0.17)
diff-lcs (1.1.3)
faker (1.2.0)
ffi (1.9.3 x86-mingw32)
gherkin (2.1.4 i386-mingw32)
i18n (0.6.9)
json_pure (1.4.6)
method_source (0.8.2)
multi_json (1.8.4)
page-object (0.9.6)
page_navigation (0.9)
pry (0.9.12.6 i386-mingw32)
rubyzip (1.1.0)
selenium-webdriver (2.39.0)
slop (3.4.7)
term-ansicolor (1.0.7)
trollop (1.16.2)
watir-webdriver (0.6.7)
websocket (1.0.7)
win32console (1.3.2 x86-mingw32)
yml_reader (0.2)
I am not able to launch chrome through Watir-Webdriver. It launches a new window and crashes.
Not sure what is going wrong. Any suggestions?
irb(main):002:0> require "watir-webdriver"
=> true
irb(main):003:0> browser = Watir::Browser.new :chrome
[8056:5984:0213/155207:ERROR:child_process_launcher.cc(332)] Failed to launch child process
[8056:1304:0213/155207:ERROR:chrome_views_delegate.cc(176)] NOT IMPLEMENTED
[8056:1304:0213/155207:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENTED
[8056:1304:0213/155208:ERROR:child_process_launcher.cc(332)] Failed to launch child process
[8056:1304:0213/155208:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENTED
[8056:1304:0213/155208:ERROR:child_process_launcher.cc(332)] Failed to launch child process
[8056:1304:0213/155208:ERROR:child_process_launcher.cc(332)] Failed to launch child process
[8056:1304:0213/155208:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENTED
[8056:1304:0213/155208:ERROR:child_process_launcher.cc(332)] Failed to launch child process
[8056:1304:0213/155208:ERROR:child_process_launcher.cc(332)] Failed to launch child process
[8056:1304:0213/155208:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENTED
[8056:1304:0213/155208:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENTED
[8056:1304:0213/155216:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENTED
Selenium::WebDriver::Error::UnknownError: unknown error: unable to discover open pages
(Driver info: chromedriver=2.6.232923,platform=Windows NT 6.1 SP1 x86_64)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/remote/response.rb:51:in `assert_ok'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/remote/http/common.rb:59:in `new'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/remote/http/default.rb:66:in `request'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/remote/bridge.rb:634:in `raw_execute'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/remote/bridge.rb:99:in `create_session'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/chrome/bridge.rb:29:in `initialize'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/common/driver.rb:37:in `new'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/common/driver.rb:37:in `for'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver.rb:67:in `for'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.7/lib/watir-webdriver/browser.rb:46:in `initialize'
from (irb):3:in `new'
from (irb):3
from C:/Ruby193/bin/irb:12:in `<main>'irb(main):004:0> exit

this is a issue related to the childprocess gem.
revert the gem to 0.3.9 should resolve this problem

Related

Chromedriver works manually but fails when ran from Jenkins Slave

I have a Jenkins slave node setup with LinuxMint. So we can do some browser testing on a Linux box in Chrome and Firefox.
I have the latest Chromedriver installed where the test can run it and when I go into /var/jenkins/workspace/<project name>/TestAutomation/SeleniumFramework manually and do my run npm <test name> the tests launch the chromedriver and run successfully.
When I go into Jenkins and run my test chromedriver is failing with the following and I am not sure where to go with this.:
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/atoms/error.js:108
var template = new Error(this.message);
^
UnknownError: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a),platform=Linux 3.19.0-32-generic x86_64)
at new bot.Error (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/atoms/error.js:108:18)
at Object.bot.response.checkResponse (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/atoms/response.js:109:9)
at /var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:160:24
at promise.ControlFlow.runInFrame_ (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1857:20)
at goog.defineClass.notify (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2448:25)
at promise.Promise.notify_ (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:564:12)
at Array.forEach (native)
at promise.Promise.notifyAll_ (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:553:15)
at goog.async.run.processWorkQueue (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/goog/async/run.js:130:15)
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:157:22)
at Function.webdriver.WebDriver.createSession (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:131:30)
at new Driver (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/selenium-webdriver/chrome.js:810:36)
at DirectDriverProvider.getNewDriver (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/protractor/lib/driverProviders/direct.js:68:16)
at Runner.createBrowser (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/protractor/lib/runner.js:182:37)
at /var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/protractor/lib/runner.js:263:21
at _fulfilled (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/q/q.js:759:13)
at /var/jenkins/workspace/QA-E2E-Linux/TestAutomation/SeleniumFramework/node_modules/q/q.js:525:49
[launcher] Process exited with error code 1
First Solution:
Have you java 8 installed? If yes, uninstall it and install java 7.
Second Solution:
Downgrade protractor to v1.8.0
~
More informations: https://github.com/angular/protractor/issues/1905
#edit
I found a similar topic as your, the same error in jenkins - linux:
In you jenkins settings add a global property
key : DISPLAY
value:0:0
On your server start Xvfb in the background:
Xvfb :0 -ac -screen 0 1024x768x24 &
link: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.9
So I was connecting to the slaves from the Jenkins master via SSH. This wasn't ever going to launch a browser session. I switched over to the Java Web Start option, and it launched the browser just fine.

protractor web-driver with selenium on linux

I have the following setup:
protractor running from a windows vm using a stand alone selenium server on a linux headless box.
The idea was to have chrome installed on my windows vm and to have protractor use this chrome install to run the tests via the selenium on the linux box. I start the selenium server on the linuxx box using webdriver-manager start.
When I run the tests from the VM I get the folloiwng error
Caused by: org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Linux 2.6.32-431.29.2.el6.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 134 milliseconds
Build info: version: '2.45.0',java.version: '1.7.0_79'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:171)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:139)
... 14 more
10:39:09.119 WARN - Exception: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Linux 2.6.32-431.29.2.el6.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 134 milliseconds
java.version: '1.7.0_79'
Driver info: org.openqa.selenium.chrome.ChromeDriver
In my protractor conf I it configured to use the selenium standalone server by specifying the selenium url.
Any ideas how to resolve this and get the browser to be opened on my windows vm rather than the linux box looking for the chrome binary.
Thanks

Watir-webdriver 64bit windows7 cannot open any browser with error unexpected response, code = 502, content-type = "text/html"

Env-
64bit Windows 7
ruby 1.9.2-P290
rubygems 1.8.24
Watir 4.0.2
When try to create a browser (Chrome or IE) instance, it will fail with below errors
When try to create a Firefox instance, it will open the Firefox and then close automatically with the same errors.
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'watir-webdriver'
=> true
irb(main):003:0> ie = Watir::Browser.new:chrome
Started ChromeDriver
port=9515
version=23.0.1240.0
log=C:\Users\y93529\chromedriver.log
Selenium::WebDriver::Error::WebDriverError: unexpected response, code=502, conte
nt-type="text/html"
<HEAD><TITLE>Connection refused</TITLE></HEAD>
<BODY BGCOLOR="white" FGCOLOR="black"><H1>Connection refused</H1><HR>
<FONT FACE="Helvetica,Arial"><B>
Description: Connection refused</B></FONT>
<HR>
<!-- default "Connection refused" response (502) -->
</BODY>
from C:/ruby/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/sele
nium/webdriver/remote/http/common.rb:66:in `create_response'
from C:/ruby/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/sele
nium/webdriver/remote/http/default.rb:66:in `request'
from C:/ruby/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/sele
nium/webdriver/remote/http/common.rb:40:in `call'
from C:/ruby/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/sele
nium/webdriver/remote/bridge.rb:615:in `raw_execute'
from C:/ruby/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/sele
nium/webdriver/remote/bridge.rb:92:in `create_session'
from C:/ruby/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/sele
nium/webdriver/remote/bridge.rb:68:in `initialize'
from C:/ruby/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/sele
nium/webdriver/chrome/bridge.rb:29:in `initialize'
from C:/ruby/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/sele
nium/webdriver/common/driver.rb:37:in `new'
from C:/ruby/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/sele
nium/webdriver/common/driver.rb:37:in `for'
from C:/ruby/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/sele
nium/webdriver.rb:67:in `for'
from C:/ruby/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.2/lib/watir-we
bdriver/browser.rb:46:in `initialize'
from (irb):3:in `new'
from (irb):3
from C:/ruby/bin/irb:12:in `<main>'
One point to add -
The same environment in 32bit windows 7, everything works good. I doubt if there is some difference of the supporting of webdriver between 64bit win7 and 32bit win7
Any advice will be highly appreciated.
It was solved!
My network has a proxy, when I tried to install the watir, I configured the command line with the proxy, so the command line can download and install watir. After installation, I did NOT delete the proxy that I configured, it was still in the envrionment variables. That's why it fails each time I tried to start a browser with watir-webdriver. Delete this proxy, everything works fine.
Thanks guys for your participate in solving this problem.

Script running on Firefox showing error

Showing Error while running script by using Firefox
With user of Roo & test/unit
I call information from excel sheet & user in executing but showing error
Showing Error as below
C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.0.9-x86-mingw32/lib/ffi/platform.rb:2
: Use RbConfig instead of obsolete and deprecated Config.
Started ChromeDriver
port=52228
version=20.0.1133.0
log=D:\chromedriver.log
C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:141:in `read_nonblock': An existing c
nnection was forcibly closed by the remote host. (Errno::ECONNRESET)
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:141:in `rbuf_fill'
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2551:in `read_new'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_
equest'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1293:in `request'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1064:in `head'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.21.2/lib/
elenium/webdriver/chrome/service.rb:62:in `block in stop'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:745:in `start'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:557:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.21.2/lib/
elenium/webdriver/chrome/service.rb:58:in `stop'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.21.2/lib/
elenium/webdriver/chrome/service.rb:52:in `block in start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.21.2/lib/
elenium/webdriver/common/platform.rb:124:in `block in exit_hook'
Please check whether you have latest ffi gem installed.
gem install ffi
Then give it a shot.

Socket error from Watir-webdriver with Firefox 6

I am getting this error message while running my watir-webdriver tests on Firefox 6 for the first time on Windows XP.
1) Error:
testAttributeGadget010_workflow_shown(AttributeGadgetTest):
Errno::EADDRINUSE: Only one usage of each socket address (protocol/network address/port) is normally permitted. - connect(2)
C:/Ruby187/lib/ruby/1.8/net/http.rb:560:in `initialize'
C:/Ruby187/lib/ruby/1.8/net/http.rb:560:in `open'
C:/Ruby187/lib/ruby/1.8/net/http.rb:560:in `connect'
C:/Ruby187/lib/ruby/1.8/timeout.rb:53:in `timeout'
C:/Ruby187/lib/ruby/1.8/timeout.rb:101:in `timeout'
C:/Ruby187/lib/ruby/1.8/net/http.rb:560:in `connect'
C:/Ruby187/lib/ruby/1.8/net/http.rb:553:in `do_start'
C:/Ruby187/lib/ruby/1.8/net/http.rb:542:in `start'
C:/Ruby187/lib/ruby/1.8/net/http.rb:1035:in `request'
C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.4.0/lib/selenium/webdriver/remote/http/default.rb:73:in `response_for'
C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.4.0/lib/selenium/webdriver/remote/http/default.rb:41:in `request'
C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.4.0/lib/selenium/webdriver/remote/http/common.rb:34:in `call'
C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.4.0/lib/selenium/webdriver/remote/bridge.rb:410:in `raw_execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.4.0/lib/selenium/webdriver/remote/bridge.rb:388:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.4.0/lib/selenium/webdriver/remote/bridge.rb:356:in `find_element_by'
C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.4.0/lib/selenium/webdriver/common/search_context.rb:41:in `find_element'
C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.2/lib/watir-webdriver/locators/element_locator.rb:86:in `find_first_by_multiple'
C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.2/lib/watir-webdriver/locators/element_locator.rb:33:in `locate'
C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.2/lib/watir-webdriver/elements/element.rb:263:in `locate'
C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.2/lib/watir-webdriver/elements/element.rb:245:in `assert_exists'
C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.2/lib/watir-webdriver/elements/checkbox.rb:19:in `set'
./library/attribOptions.rb:22:in `attribOptions'
./library/attribOptions.rb:20:in `each_index'
./library/attribOptions.rb:20:in `attribOptions'
./007_wb_attribute.rb:365:in `testAttributeGadget010_workflow_shown'
./007_wb_attribute.rb:345:in `each'
./007_wb_attribute.rb:345:in `testAttributeGadget010_workflow_shown'
Seems to have happen 20 times out of my 100+ Test/Unit test cases.
Has anyone any idea what is going wrong?
Almost sounds like you're running out of ephemeral ports, which shouldn't really happen with just one Firefox instance. But who knows with Windows. Try increasing the MaxUserPort setting as described here.

Resources