Getting following error while executing my selenium script - java

Stack Trace of the Exception
1477308809616 geckodriver INFO Listening on 127.0.0.1:11372
Oct 24, 2016 5:03:30 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
1477308810262 mozprofile::profile INFO Using profile path C:\Users\PC-4\AppData\Local\Temp\rust_mozprofile.ppHCF7hshpOY
1477308810264 geckodriver::marionette INFO Starting browser C:\Program Files (x86)\Mozilla Firefox\firefox.exe
1477308810268 geckodriver::marionette INFO Connecting to Marionette on localhost:55966
1477308811347 Marionette INFO Listening on port 55966
1477308813944 Marionette INFO startBrowser 09e1e5f6-dc4a-4dcb-a2ad-783499097077
Oct 24, 2016 5:03:34 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
[Child 7676] ###!!! ABORT: Aborting on channel error.: file c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/ipc/glue/MessageChannel.cpp, line 2052
Exception in thread "main" org.openqa.selenium.WebDriverException: Failed to decode response from marionette
Build info: version: 'unknown', revision: '1969d75', time: '2016-10-18 09:43:45 -0700'
System info: host: 'Sheetal', ip: '192.168.1.16', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_40'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, marionette=true, firefoxOptions={args=[], prefs={}}, appBuildId=20161019084923, version=, platform=XP, proxy={}, command_id=1, specificationLevel=0, acceptSslCerts=false, processId=7960, browserVersion=49.0.2, platformVersion=6.3, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=firefox, takesScreenshot=true, takesElementScreenshot=true, platformName=windows_nt, device=desktop}]
Session ID: 09e1e5f6-dc4a-4dcb-a2ad-783499097077
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:127)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:93)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:42)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:322)
at org.openqa.selenium.remote.RemoteWebDriver$RemoteNavigation.to(RemoteWebDriver.java:902)
at webdriverdemo.main(webdriverdemo.java:18)

Try this code:-
String currentDir = System.getProperty("user.dir");
String marionetteDriverLocation = currentDir +"/tools/marionette/wires.exe";
System.setProperty("webdriver.gecko.driver", marionetteDriverLocation);
WebDriver driver = new MarionetteDriver();
Change the name of geckodriver to wires.exe

Related

UnreachableBrowserException - when using PhantomJS with java on OrangePiOne (Ubuntu 18.04.2)

I want to fill a html form on a website with my small java program using PhantomJS. It is tested on my Win 10 machine and works perfectly. I would also like to run it on my OrangePiOne (Armbian 5.85 and Ubuntu 18.04.2). Every time I run the program I get the following exception:
Oct 10, 2019 10:24:07 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: executable: /home/ma/java_crontab_apps/phantomjs
Oct 10, 2019 10:24:07 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: port: 11594
Oct 10, 2019 10:24:07 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: arguments: [--webdriver=11594, --webdriver-logfile=/home/ma/java_crontab_apps/phantomjsdriver.log]
Oct 10, 2019 10:24:07 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: environment: {}
/home/ma/java_crontab_apps/phantomjs: 2: /home/ma/java_crontab_apps/phantomjs: Syntax error: word unexpected (expecting ")")
ERROR org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'orangepione', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'arm', os.version: '4.19.38-sunxi', java.version: '11.0.2'
Driver info: driver.version: PhantomJSDriver
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'orangepione', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'arm', os.version: '4.19.38-sunxi', java.version: '11.0.2'
Driver info: driver.version: PhantomJSDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:115)
at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:110)
at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:99)
at com.example.suche.PhantomJsFormFill.createDriver(PhantomJsFormFill.java:76)
at com.example.suche.PhantomJsFormFill.<init>(PhantomJsFormFill.java:32)
at com.example.suche.Suche.main(Suche.java:98)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'orangepione', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'arm', os.version: '4.19.38-sunxi', java.version: '11.0.2'
Driver info: driver.version: PhantomJSDriver
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:165)
at org.openqa.selenium.phantomjs.PhantomJSCommandExecutor.execute(PhantomJSCommandExecutor.java:78)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527)
... 16 more
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:11594/status] to be available after 20027 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:104)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:163)
... 18 more
Caused by: com.google.common.util.concurrent.UncheckedTimeoutException: java.util.concurrent.TimeoutException
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:143)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:79)
... 19 more
Caused by: java.util.concurrent.TimeoutException
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:204)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:130)
... 20 more
In the following method I am setting up the driver but get the exception during the return statement:
private WebDriver createDriver(String phantomjsExeutableFilePath) {
Suche.log(":::phantomjs path: " + phantomjsExeutableFilePath);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setJavascriptEnabled(true);
capabilities.setCapability(PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomjsExeutableFilePath);
return new PhantomJSDriver(capabilities); // Exception is thrown here
}
I have downloaded the PhantomJS lib from official site and also chmod'ed it.
Could it be the fault of OrangePiOne or am I missing something?
It worked when I used phantomjs build for rasberry pi instead the one from the official site.
This issue was solved with phantomjs-on-rasberrypi from https://github.com/fg2it/phantomjs-on-raspberry.

Firefox is getting failed on startup very first time with error connection refused

System
GeckoDriver Version: 0.24.0
Platform: Window 10
Firefox: 65.0
Selenium: 3.141.59
Testcase
When I am running Firefox driver, very first time it's getting failed after that it's working fine on every run.
This is happening by following way :
If I'm using selenium standalone server, on every restart of selenium server.
On every restart of my machine
If I'm using selenium standalone server and trying to run multiple thread with multiple browser simultaneously, All browsers work well except Firefox, This can be fail on any run.
Stacktrace
org.openqa.selenium.WebDriverException: connection refused
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'SAURABH-PC', ip: '192.168.3.8', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version:
'1.8.0_161'
Driver info: driver.version: unknown
remote stacktrace:
Command duration or timeout: 66.09 seconds
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$errorHandler$0(JsonWireProtocolResponse.java:54)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:252)
Code
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:49153/wd/hub"), capabilities);
Command to run Selenium-standalone.jar
java -Dwebdriver.gecko.driver=<path-to-geckodriver>\geckodriver.exe -jar <path-to-selenium-server-standalone.jar>\selenium-server-standalone.jar -port 49153
Trace level logs
Feb 06, 2019 6:29:24 PM org.openqa.selenium.remote.DesiredCapabilities firefox
INFO: Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
Feb 06, 2019 6:29:44 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
"value":{"error":"unknown error","message":"connection refused","stacktrace":""}}
1549457898669 mozrunner::runner INFO Running command: "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\Saurabh\\AppData\\Local\\Temp\\rust_mozprofile.2UOp20Lx725Q"
1549457899002 geckodriver::marionette DEBUG Waiting 60s to connect to browser on 127.0.0.1:51325
1549457915749 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/
1549457915749 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid host permission: about:reader*
1549457916114 Marionette TRACE Received observer notification profile-after-change
1549457917888 Marionette TRACE Received observer notification toplevel-window-ready
1549457918713 Marionette TRACE Received observer notification command-line-startup
1549457918714 Marionette TRACE Received observer notification nsPref:changed
1549457918714 Marionette DEBUG Init aborted (running=false, enabled=true, finalUIStartup=false)
1549457925550 Marionette TRACE Received observer notification toplevel-window-ready
1549457948093 Marionette TRACE Received observer notification sessionstore-windows-restored
1549457948093 Marionette TRACE Waiting until startup recorder finished recording startup scripts...
1549457959572 mozrunner::runner DEBUG Killing process 11516
Exiting due to channel error.
Exiting due to channel error.
1549457960997 webdriver::server DEBUG <- 500 Internal Server Error {"value":{"error":"unknown error","message":"connection refused","stacktrace":""}}
1549457965775 mozrunner::runner INFO Running command: "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\Saurabh\\AppData\\Local\\Temp\\rust_mozprofile.0d9kqn5LP57h"
1549457965997 geckodriver::marionette DEBUG Waiting 60s to connect to browser on 127.0.0.1:51620
1549457995244 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/
1549457995245 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid host permission: about:reader*
1549457995902 Marionette TRACE Received observer notification profile-after-change
1549457998402 Marionette TRACE Received observer notification toplevel-window-ready
1549457998814 Marionette TRACE Received observer notification command-line-startup
1549457998814 Marionette TRACE Received observer notification nsPref:changed
1549457998814 Marionette DEBUG Init aborted (running=false, enabled=true, finalUIStartup=false)
This error message...
org.openqa.selenium.WebDriverException: connection refused
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' System info: host: 'SAURABH-PC', ip: '192.168.3.8', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161' Driver info: driver.version: unknown
...implies that the GeckoDriver was unable to initiate/spawn a new WebBrowsing Session i.e. Firefox Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
Your JDK version is 1.8.0_161 which is pretty ancient.
So there is a clear mismatch between the JDK v8u161 , Selenium Client v3.141.59 , GeckoDriver v0.24.0 and the Firefox Browser v65.0
Solution
Upgrade JDK to recent levels JDK 8u191.

Selenium HTML Runner fails with permission denied

I have Firefox 45.9.0, Selnium 3.4 Html Runner and geckodriver 0.18 installed on Raspberry Pi 3. I am running it like
java -jar selenium-html-runner-3.4.0.jar -htmlSuite "*firefox" "http://localhost:88" /home/michal/abc/suite.html /home/michal/abc
but some commands like clickAndWait or type fails with permission denied error in result file.
com.thoughtworks.selenium.SeleniumException: Error: Permission denied to access property '__webdriverAlerts'
output printed to stdout
Multi-window mode is longer used as an option and will be ignored.
1500909971572 geckodriver INFO geckodriver 0.18.0
1500909971595 geckodriver INFO Listening on 127.0.0.1:25370
1500909972680 geckodriver::marionette INFO Starting browser /usr/bin/firefox with args ["-marionette"]
Čvc 24, 2017 5:26:22 ODP. org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
2017-07-24 17:26:23.090:INFO::main: Logging initialized #13587ms to org.seleniumhq.jetty9.util.log.StdErrLog
2017-07-24 17:26:23.289:INFO:osjs.Server:main: jetty-9.4.z-SNAPSHOT
2017-07-24 17:26:23.371:INFO:osjsh.ContextHandler:main: Started o.s.j.s.h.ContextHandler#5c8d3f{/tests,null,AVAILABLE}
2017-07-24 17:26:23.415:INFO:osjs.AbstractConnector:main: Started ServerConnector#1c1b556{HTTP/1.1,[http/1.1]}{0.0.0.0:15196}
2017-07-24 17:26:23.417:INFO:osjs.Server:main: Started #13915ms
Čvc 24, 2017 5:26:25 ODP. org.openqa.selenium.server.htmlrunner.CoreTestCase run
INFO: |open | http://localhost:88/ | |
Čvc 24, 2017 5:26:26 ODP. org.openqa.selenium.server.htmlrunner.CoreTestCase run
INFO: |selectWindow | null | |
Čvc 24, 2017 5:26:26 ODP. org.openqa.selenium.server.htmlrunner.CoreTestCase run
INFO: |clickAndWait | link=Blog | |
test.html
test</td></tr>
</tbody></table>
2017-07-24 17:26:27.414:INFO:osjs.AbstractConnector:main: Stopped ServerConnector#1c1b556{HTTP/1.1,[http/1.1]}{0.0.0.0:15196}
2017-07-24 17:26:27.416:INFO:osjsh.ContextHandler:main: Stopped o.s.j.s.h.ContextHandler#5c8d3f{/tests,null,UNAVAILABLE}
Čvc 24, 2017 5:26:27 ODP. org.openqa.selenium.remote.ErrorCodes toStatus
INFO: HTTP Status: '404' -> incorrect JSON status mapping for 'unknown error' (500 expected)
Čvc 24, 2017 5:26:29 ODP. org.openqa.selenium.os.UnixProcess destroy
INFO: Command failed to close cleanly. Destroying forcefully (v2). [/home/michal/selenium/geckodriver, --port=25370, -b, /usr/bin/firefox][ {}]
Čvc 24, 2017 5:26:30 ODP. org.openqa.selenium.os.UnixProcess destroy
SEVERE: Unable to kill process with PID 4786
Čvc 24, 2017 5:26:30 ODP. org.openqa.selenium.server.htmlrunner.HTMLLauncher mainInt
WARNING: Test of browser failed: *firefox
org.openqa.selenium.WebDriverException: quit
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'raspberrypi', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'arm', os.version: '4.9.35-v7+', java.version: '1.8.0_65'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, appBuildId=20170419042421, version=45.9.0, platform=LINUX, proxy=Proxy(), specificationLevel=1, acceptSslCerts=false, browserVersion=45.9.0, platformVersion=4.9.35-v7+, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=Firefox, takesScreenshot=true, takesElementScreenshot=true, javascriptEnabled=true, platformName=Linux, device=desktop}]
Session ID: 19afb854-e7b4-4e84-807e-62a9c6ece5f4
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:150)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:115)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:45)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:694)
at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:533)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:139)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.mainInt(HTMLLauncher.java:245)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.main(HTMLLauncher.java:273)
On the geckodriver github page https://github.com/mozilla/geckodriver/releases i found that geckodriver 0.18 is recommended to use with Firefox 53+ but when i choose older geckodriver the output result is the same.
Tests based only on open and verify commands works. How can I get working all tests?
Change selenium to 2.53 version. You use firefox version 45 and this version dont work with selenium v3.4.

selenium UnreachableBrowserException

i'm trying to run some Selenium test on a bamboo server, using Xvfb to simulate a display.
The tests work with ChromeDriver and phantomJS, but it crash with Firefox :
Forking command line: /bin/sh -c cd /usr/local/bamboo/BAMBOO/xml-data/build-dir/SL-SL-JOB1 && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar /usr/local/bamboo/BAMBOO/xml-data/build-dir/SL-SL-JOB1/target/surefire/surefirebooter1260921380504465598.jar /usr/local/bamboo/BAMBOO/xml-data/build-dir/SL-SL-JOB1/target/surefire/surefire4923082243141341705tmp /usr/local/bamboo/BAMBOO/xml-data/build-dir/SL-SL-JOB1/target/surefire/surefire_04348841300974089213tmp
Running com.lazerycode.selenium.tests.GoogleExampleIT
Configuring TestNG with: TestNG60Configurator
Current Operating System: LINUX
Current Architecture: amd64
Current Browser Selection: FIREFOX
1495535703540 geckodriver INFO Listening on 127.0.0.1:17068
1495535704705 geckodriver::marionette INFO Starting browser /usr/lib/firefox/firefox.sh with args ["-marionette"]
1495535709415 Marionette INFO Listening on port 39935
1495535709539 Marionette WARN TLS certificate errors will be ignored for this session
mai 23, 2017 12:35:10 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFOS: Detected dialect: W3C
mai 23, 2017 12:35:12 PM org.openqa.selenium.os.UnixProcess destroy
INFOS: Command failed to close cleanly. Destroying forcefully (v2). [/usr/local/bamboo/BAMBOO/xml-data/build-dir/SL-SL-JOB1/src/test/resources/selenium_standalone_binaries/linux/marionette/64bit/geckodriver, --port=17068][ {}]
mai 23, 2017 12:35:13 PM org.openqa.selenium.os.UnixProcess destroy
GRAVE: Unable to kill process with PID 4042
Tests run: 5, Failures: 2, Errors: 0, Skipped: 3, Time elapsed: 11.775 sec <<< FAILURE! - in com.lazerycode.selenium.tests.GoogleExampleIT
setup(com.lazerycode.selenium.tests.GoogleExampleIT) Time elapsed: 11.021 sec <<< FAILURE!
org.openqa.selenium.remote.UnreachableBrowserException:
Error communicating with the remote browser. It may have died.
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'vps409374', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-78-generic', java.version: '1.8.0_131'
Driver info: driver.version: RemoteWebDriver
Capabilities [{moz:profile=/tmp/rust_mozprofile.3cTlgJI5I9iE, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=true, browserVersion=53.0.2, platformVersion=4.4.0-78-generic, moz:processID=4050.0, browserName=firefox, javascriptEnabled=true, platformName=linux}]
Session ID: 329b5087-5597-478b-9dac-6472c5490aee
at com.lazerycode.selenium.tests.GoogleExampleIT.setup(GoogleExampleIT.java:21)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:17068 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
at com.lazerycode.selenium.tests.GoogleExampleIT.setup(GoogleExampleIT.java:21)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at com.lazerycode.selenium.tests.GoogleExampleIT.setup(GoogleExampleIT.java:21)
closeDriverObjects(com.lazerycode.selenium.tests.GoogleExampleIT) Time elapsed: 11.605 sec <<< FAILURE!
org.openqa.selenium.remote.UnreachableBrowserException:
Error communicating with the remote browser. It may have died.
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'vps409374', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-78-generic', java.version: '1.8.0_131'
Driver info: driver.version: RemoteWebDriver
Capabilities [{moz:profile=/tmp/rust_mozprofile.3cTlgJI5I9iE, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=true, browserVersion=53.0.2, platformVersion=4.4.0-78-generic, moz:processID=4050.0, browserName=firefox, javascriptEnabled=true, platformName=linux}]
Session ID: 329b5087-5597-478b-9dac-6472c5490aee
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:17068 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
Results :
Failed tests:
GoogleExampleIT>DriverBase.closeDriverObjects:43 » UnreachableBrowser Error co...
GoogleExampleIT.setup:21 » UnreachableBrowser Error communicating with the rem...
Tests run: 5, Failures: 2, Errors: 0, Skipped: 3
You can find all test code here on github : https://github.com/Joel-Costamagna/Selenium-Maven-Template
It seems the version of Firefox and GeckoDriver is not matching with each other, please check the compatibility of both for versions.
You can also try using latest version of GeckoDriver which can be downloaded from https://github.com/mozilla/geckodriver/releases.

PhatntomJs with Selenium is not able to start session

I am using PhantomJs with Selenium for headless automation. It worked well for me until today. Now, I am getting the below exception when I am initializing the PhantomJs driver.
The code I am using is as follows:
Capabilities caps = new DesiredCapabilities();
((DesiredCapabilities) caps).setJavascriptEnabled(true);
((DesiredCapabilities)caps).setCapability("phantomjs.binary.path", System.getProperty("user.dir")
+ "\\src\\main\\resources\\phantomjs.exe");
WebDriver driver = new PhantomJSDriver(caps);
ERROR:
Jul 27, 2016 9:20:01 PM
org.openqa.selenium.phantomjs.PhantomJSDriverService INFO:
executable: C:\Users\Ajatshatru
Singh\workspace\Assignment\src\main\resources\phantomjs.exe Jul 27,
2016 9:20:01 PM org.openqa.selenium.phantomjs.PhantomJSDriverService
INFO: port: 48904 Jul 27, 2016 9:20:01 PM
org.openqa.selenium.phantomjs.PhantomJSDriverService INFO:
arguments: [--webdriver=48904, --webdriver-logfile=C:\Users\Ajatshatru
Singh\workspace\Assignment\phantomjsdriver.log] Jul 27, 2016 9:20:01
PM org.openqa.selenium.phantomjs.PhantomJSDriverService INFO:
environment: {} Exception in thread "main"
org.openqa.selenium.remote.UnreachableBrowserException: Could not
start a new session. Possible causes are invalid address of the remote
server or browser start-up failure. Build info: version: '2.39.0',
revision: '14fa800511cc5d66d426e08b0b2ab926c7ed7398', time:
'2013-12-16 13:18:38' System info: host: 'Ajatshatru', ip:
'10.31.32.236', os.name: 'Windows 8', os.arch: 'amd64', os.version:
'6.2', java.version: '1.7.0_51' Driver info: driver.version:
PhantomJSDriver at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
at
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
at
org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:111)
at
org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:115)
at
org.openqa.selenium.phantomjs.PhantomJSDriver.(PhantomJSDriver.java:110)
at
org.openqa.selenium.phantomjs.PhantomJSDriver.(PhantomJSDriver.java:99)
at Partik.Assignment.WebDriverQueue.main(WebDriverQueue.java:37)
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting
for driver server to start. Build info: version: '2.39.0', revision:
'14fa800511cc5d66d426e08b0b2ab926c7ed7398', time: '2013-12-16
13:18:38' System info: host: 'Ajatshatru', ip: '10.31.32.236',
os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2',
java.version: '1.7.0_51' Driver info: driver.version: PhantomJSDriver
at
org.openqa.selenium.remote.service.DriverService.start(DriverService.java:165)
at
org.openqa.selenium.phantomjs.PhantomJSCommandExecutor.execute(PhantomJSCommandExecutor.java:78)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527)
... 6 more Caused by:
org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting
for [http://localhost:48904/status] to be available after 20004 ms at
org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:104)
at
org.openqa.selenium.remote.service.DriverService.start(DriverService.java:163)
... 8 more Caused by:
com.google.common.util.concurrent.UncheckedTimeoutException:
java.util.concurrent.TimeoutException at
com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:143)
at
org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:79)
... 9 more Caused by: java.util.concurrent.TimeoutException at
java.util.concurrent.FutureTask.get(Unknown Source) at
com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:130)
... 10 more
Well a simple restart did it for me. :|

Categories