I am getting the following error when I run this code in my automation suite,
Selenium 2.47.1
Internet Explorer 11
OS: Windows 8
WebDriver driver = new InternetExplorerDriver();
Exception Trace:
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.47.1',
revision: 'unknown', time: '2015-07-30 11:02:44' System info: host:
os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2',
java.version: '1.7.0_51' Driver info: driver.version:
InternetExplorerDriver at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:589)
at
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
at
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:227)
at
org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:182)
at
org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:174)
at
org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:146)
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting
for driver server to start. Build info: version: '2.47.1', revision:
'unknown', time: '2015-07-30 11:02:44' System info: host: os.name:
'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version:
'1.7.0_51' Driver info: driver.version: InternetExplorerDriver at
org.openqa.selenium.remote.service.DriverService.start(DriverService.java:170)
at
org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:63)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:568)
at
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
at
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:227)
at
org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:182)
at
org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:174)
at
org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:146)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed
out waiting for [http://localhost:23905/status] to be available after
20005 ms at
org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:104)
at
org.openqa.selenium.remote.service.DriverService.start(DriverService.java:167)
... 50 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)
... 51 more Caused by: java.util.concurrent.TimeoutException at
java.util.concurrent.FutureTask.get(FutureTask.java:201) at
com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:130)
... 52 more
I solved the problem by configuring the system property for the internet explorer driver,
System.setProperty("webdriver.ie.driver", "IEDriverServer.exe");
And changed the protected mode setting to be same for all the zones.
Related
I am using Cucumber and Java to automate Selenium test cases. Using Jenkins to execute the job. The job is scheduled to run every day. However, after a few test case runs, my task failed with the following error, which is an intermittent problem. Is there anything that can be done in this scenario?
Error:
org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:29896
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'QTSAUTOMATION', ip: '10.2.0.166', os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_241'
Driver info: driver.version: RemoteWebDriver at com.TestAutomation.TestRunner.TestRunner.runScenario(TestRunner.java:38) Caused by: java.net.ConnectException: Connection refused: connect
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.
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. :|
Encountered the following error. Cannot identify the exact root cause.
Error Message
Failed to connect to binary FirefoxBinary(/usr/lib64/firefox/firefox) on port 7055; process output follows:
Error: cannot open display: :99
Error: cannot open display: :99
Build info: version: '2.45.0', revision: '32a636c', time: '2015-03-05 22:01:35'
System info: host: 'nila.ejyothi.net', ip: '192.168.202.35', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-229.20.1.el7.x86_64', java.version: '1.7.0_91'
Driver info: driver.version: FirefoxDriver
Stacktrace
org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/usr/lib64/firefox/firefox) on port 7055; process output follows:
Error: cannot open display: :99
Error: cannot open display: :99
Build info: version: '2.45.0', revision: '32a636c', time: '2015-03-05 22:01:35'
System info: host: 'nila.ejyothi.net', ip: '192.168.202.35', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-229.20.1.el7.x86_64', java.version: '1.7.0_91'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:130)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:182)
at com.fetchinglife.application.modules.utilities.CommonFunctions.initBrowser(CommonFunctions.java:74)
at com.fetchinglife.application.modules.employee.EmployeeScheduleFunctionalTest.StartBrowser_NavURL(EmployeeScheduleFunctionalTest.java:34)
Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: cannot open display: :99
Error: cannot open display: :99
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
This is likely to happen when Selenium webDriver API can't load Firefox driver.
Possible cause could be compatibility between Firefox version and Selenium server version.
Use the latest Selenium Server 2.51.0
I'm having issues starting up the PhantomJS driver. It works just fine on my local machine (OSX) but I'm having issues getting it started on the server (Linux).
Here's the code that causes the issue:
DesiredCapabilities dcap = new DesiredCapabilities();
String[] phantomArgs = new String[] { "--webdriver-loglevel=NONE" };
dcap.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, phantomArgs);
dcap.setCapability("phantomjs.binary.path", "/usr/local/bin/phantomjs");
WebDriver driver = new PhantomJSDriver(dcap);
And here's the stack trace of the issue:
[ERROR] [09/09/2015 18:32:45.517] [pipeline-akka.actor.default-dispatcher-11] [akka://pipeline/user/$u] 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: os.name: 'Linux', os.arch: 'amd64', os.version: '3.14.48-33.39.amzn1.x86_64', java.version: '1.8.0_60'
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: os.name: 'Linux', os.arch: 'amd64', os.version: '3.14.48-33.39.amzn1.x86_64', java.version: '1.8.0_60'
Driver info: driver.version: PhantomJSDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:589)
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.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:110)
at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:99)
at com.example.p.Test.ingest(GoogleGetLinksPipe.java:48)
at com.example.p.Test.ingest(GoogleGetLinksPipe.java:22)
at com.example.p.AbstractPipe.onReceive(AbstractPipe.java:39)
at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:167)
at akka.actor.Actor$class.aroundReceive(Actor.scala:467)
at akka.actor.UntypedActor.aroundReceive(UntypedActor.scala:97)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
at akka.actor.ActorCell.invoke(ActorCell.scala:487)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)
at akka.dispatch.Mailbox.run(Mailbox.scala:220)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
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: os.name: 'Linux', os.arch: 'amd64', os.version: '3.14.48-33.39.amzn1.x86_64', java.version: '1.8.0_60'
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:568)
... 20 more
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:8092/status] to be available after 20000 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:104)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:163)
... 22 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)
... 23 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)
... 24 more
I built the PhantomJS from source and had it working before - it ran through the tests just fine. Additionally, it works locally on my machine. Any thoughts on what could be causing the issue?
The problem was due to the phantomjs's inability to write to the log file. Changing the file permissions of the log file resolved the issue.