I am trying to run an instance of BrowserStackLocal from Java 7 using Selenium. I am using Windows 10.
I am aware that if you use BrowserStackLocal in Java, you need to run the following line of code in the cmd.exe and have it open:
BrowserStackLocal.exe --key <pass_key>
But instead of executing it externally, I want to be able to open the command line from the code.
I am also running the BrowserStack code on differing machines, so I want to be able to call the above command relatively (and not use an absolute path).
So I am running this code ((browserStackLocalPath) is the name of the BrowserStackLocal executable object and (key) is the pass key):
// Initializing desired capabilities.
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("browserstack.local", "true");
caps.setCapability("browser", "Chrome");
caps.setCapability("browser_version", "50.0");
caps.setCapability("os", "Windows");
caps.setCapability("os_version", "7");
// Initializing command line parameters...
CommandLine cmdLine = new CommandLine("cmd.exe");
cmdLine.addArgument(browserStackLocalPath);
cmdLine.addArgument("--key");
cmdLine.addArgument(key);
DefaultExecutor executor = new DefaultExecutor();
exitValue = executor.execute(cmdLine);
RemoteWebDriver webDriver = new RemoteWebDriver(new
URL(browserStackURL), caps);
...and this has merely resulted in a WebDriverException:
org.openqa.selenium.WebDriverException: [browserstack.local] is set to true but local testing through BrowserStack is not connected. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 870 milliseconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'rchen-PC', ip: '192.168.11.105', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.7.0_80'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
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:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:158)
Any ideas on what might be missing?
The error indicates that the test was initiated before the Local Testing connection could be established. It takes a few seconds (5-10) to successfully establish the connection. I suggest you add a sleep of 10 seconds (Thread.sleep(10000);) after running the execute command.
Alternatively, you can try the Java bindings for BrowserStackLocal available here - https://github.com/browserstack/browserstack-local-java . This helps manage the Local Testing binary programatically.
Related
I have a Selenium/Java program that runs, sleeps for 15 minutes and then run again (All this is from within Java, I am not using cron or similar. In other words, my program always stays open. This is just a hack.)
The computer I run this on had a brief network problem and after that the following stack trace was generated
1604945147412 Marionette INFO Stopped listening on port 49990
1604946047821 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/21/htmxfgcx7v14bbt2nr6v7ms40000gn/T/rust_mozprofile.1KxcETWwVjqE"
Exception in thread "main" org.openqa.selenium.WebDriverException: invalid argument: can't kill an exited process
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: '15.local', ip: '2002:c3bd:1b0a:0:9981:5f04:7c52:f5f7', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.4', java.version: '1.8.0_60'
Driver info: driver.version: FirefoxDriver
remote stacktrace:
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.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
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.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
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.firefox.FirefoxDriver.<init>(FirefoxDriver.java:147)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
at kameo.KameoBid.main(MyApp.java:23)
Line 23:
WebDriver driver = new FirefoxDriver();
The program had been running fine for 20 hours (that is, it runs for 10 seconds, then Thread.sleep(1000*60*15) followed by a loop while (true)) when this happened. In other words, it runs fine and stable.
I have seen a couple of other questions with the same error message but the problem in those cases the problem seems to be an incompatibility between geckodriver and Firefox and the problem occurs immediatly, on the first run (I perform a driver.close(); just before my 15 minutes sleep).
An "unused" Firefox was left open when I discovered this problem. Don't know if that is significant.
Any ideas?
This error message...
Exception in thread "main" org.openqa.selenium.WebDriverException: invalid argument: can't kill an exited process
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: '15.local', ip: '2002:c3bd:1b0a:0:9981:5f04:7c52:f5f7', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.4', java.version: '1.8.0_60'
Driver info: driver.version: FirefoxDriver
remote stacktrace:
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
...implies that the GeckoDriver was unable to initiate/spawn a new Browsing Context i.e. Firefox Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
Though your Selenium Client version is the recent one i.e. v3.141.59
Your JDK version is 1.8.0_60 which is pretty old and ancient.
So there is a clear mismatch between the JDK v8u60 and Selenium Client v3.141.59.
Solution
Ensure that:
JDK is upgraded to current levels JDK 8u261.
Take a System Reboot.
Execute your Test as a non-root user.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
MAC: 10.11.6,
Selenium: 2.53(Also tried with 3.4 and 3.8) &
Java 1.8
Driver settings tried:
String exePath ="/usr/local/Cellar/chromedriver/2.35/bin/chromedriver";
System.setProperty("webdriver.chrome.driver", exePath);
WebDriver driver = new ChromeDriver();
driver = new ChromeDriver(options);
Error stack trace:
Starting ChromeDriver 2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef) on port 14988
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created exception
from disconnected: unable to connect to renderer
(Session info: chrome=64.0.3282.140)
(Driver info: chromedriver=2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.55 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:32:46'
System info: host: '01hw382197', ip: '172.25.155.171', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
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:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:159)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:116)
at dataAndConfig.DriverClass.getDriver(DriverClass.java:39)
at scriptsPostPaidWebApp.BillingPayNow.main(BillingPayNow.java:27)
Have a look at the following links:
https://github.com/SeleniumHQ/selenium/issues/4897
WebDriverError: disconnected: unable to connect to renderer
https://github.com/SeleniumHQ/selenium/issues/4979
First off you should make sure that your ChromeDriver supports your Chrome version. Since you are using ChromeDriver 2.3.5 and Google Chrome v64 you should be fine. (you still might want to upgrade your Selenium version)
According to the links posted above, you need to comment out every method that manipulates the window size of your browser in any way. e.g. setMaximize().
If that didnt work, you might want to give options.addArguments("no-sandbox"); a try.
I have an issue with Edge browser below is my code.The browser opens but control never goes to the browser instead execution halts and shows the error
service = new EdgeDriverService.Builder()
.usingDriverExecutable(new File("C:\\Program Files (x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe"))
.usingAnyFreePort()
.build();
service.start();
driver = new EdgeDriver(service, DesiredCapabilities.edge());
driver.get("http://xyz.in");
On executing the line driver = new EdgeDriver(service, DesiredCapabilities.edge()); edge browser is getting launched after that execution is failing with the error as
'FAILED: test
org.openqa.selenium.remote.SessionNotFoundException: null (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.98 seconds
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:55:52'
System info: host: 'ODERWin10', ip: '192.168.1.119', os.name: 'Windows 8', os.arch: 'x86', os.version: '6.2', java.version: '1.7.0_13'
Driver info: org.openqa.selenium.edge.EdgeDriver
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.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:164)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:152)
at Pack1.CrossBrowserTest.test(CrossBrowserTest.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)'
Please suggest a solution, thanks in advance
Selenium 2.48.2 recognizes Windows 10 as Windows 8, i get the same error. The only way I've been able to get Edge to open and not hang is to manually open the MicrosoftWebDriver.exe file, and input whatever URL it tells me it's listening on:
DesiredCapabilities browser = DesiredCapabilities.edge();
browser.setBrowserName(DesiredCapabilities.edge().getBrowserName());
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:17556"), browser);
I had the same problem with SessionNotFoundException
Be sure to use the latest WebDriver for Windows Insiders from here https://www.microsoft.com/en-us/download/details.aspx?id=48740 (the normal one from here https://www.microsoft.com/en-us/download/confirmation.aspx?id=48212 does not work anymore on newer Windows 10 builds than 10240)
The 'Windows 8' display problem is as far as I know only a wrong output and not the root of the issue. Nonetheless it is fixed in selenium 2.49.0 (it's bug #669)
The problem is that you are trying to use Edge on a system in which it is not installed.
As told here :
System info: host: 'ODERWin10', ip: '192.168.1.119', os.name: 'Windows 8', os.arch: 'x86', os.version: '6.2', java.version: '1.7.0_13'
You are on Windows 8.
Edge is only supported and available on Windows 10.
You need to use a Windows 10 machine to run you test.
I'm very new to Selenium. Below given is my first test script.
Question: Does it require selenium server to test a local website (which is hosted in the same machine as the test scripts being run).
Also tried executing the same script from Internet Explorer also, still getting the same.
It just opens the browser and closes(because of finally block) it.
import org.openqa.selenium.chrome.ChromeDriver;
public class TestScript {
/**
* #param args
* #throws InterruptedException
*/
public static void main(String[] args) {
ChromeDriver driver = null;
try
{
System.setProperty("webdriver.chrome.driver", "C:\\Users\\user1\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe");
driver = new ChromeDriver();
System.out.println("Opening the Browser");
driver.get("http://localhsot:5080/myWebSite/8450191#");
System.out.println("Open the Browser");
System.out.println("");
System.out.println("Title" +driver.getTitle());
}
catch (Exception ie)
{
ie.printStackTrace();
}
finally
{
System.out.println("Quitting the Browser");
driver.close();
driver.quit();
}
}
}
Exception: Below is the exception I am getting while executing from the Eclipse:
[2820:6204:36503609:ERROR:gpu_info_collector_win.cc(93)] Can't retrieve a valid WinSAT assessment.
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: 'ff23eac', time: '2013-12-16 16:12:12'
System info: host: '01hw535163', ip: '10.72.15.53', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_17'
Driver info: driver.version: ChromeDriver
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:112)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:116)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:162)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:108)
at com.seic.scripts.TestScript.main(TestScript.java:16)
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:12:12'
System info: host: '01hw535163', ip: '10.72.15.53', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_17'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:165)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:62)
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:37571/status] to be available after 20009 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$Sync.innerGet(FutureTask.java:228)
at java.util.concurrent.FutureTask.get(FutureTask.java:91)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:130)
... 10 more
Quitting the Browser
Exception in thread "Main Thread" java.lang.NullPointerException
at com.scripts.TestScript.main(TestScript.java:31)
Chrome Version: 21.0.1171.0
OS: Windows 7 64 bit.
Selenium Web Driver version:2.39.0
You are getting a little confused about what you need to point Selenium to.
Here:
System.setProperty("webdriver.chrome.driver", "C:\\Users\\user1\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe");
This setting, webdriver.chrome.driver is a setting that Selenium will read to find out where the ChromeDriver is located, not the actual Chrome installation.
https://code.google.com/p/selenium/wiki/ChromeDriver
You must download the ChromeDriver and where it is located should be what you pass in for the webdriver.chrome.driver property.
I imagine it's the same reason when you try with IE, it also requires a driver which I guess you don't have:
https://code.google.com/p/selenium/wiki/InternetExplorerDriver
In terms of whether you need a "server" -> for your tests, no, you are not running them remotely. Once you decide to run them remotely (i.e use the RemoteWebDriver instead of ChromeDriver) then you will need the Selenium server.
I would recommend instead of using System.setProperty() to put your drivers in the same folder and point to that folder in System Variables Path. Then you don't need to point to it at all in code and updating your driver won't require a code rewrite.
I have an application that uses Selenium Webdriver to get some information from a site. It works fine with FirefoxDriver and ChromeDriver, but when I tried to switch to PhantomJSDriver, I encountered some difficulties.
On a Windows machine , it starts normally, then immediately begins spitting out the following lines over and over again:
Jan 05, 2014 7:28:43 PM org.apache.http.impl.client.DefaultRequestDirector tryEx
ecute
INFO: I/O exception (org.apache.http.NoHttpResponseException) caught when processing request: The target server failed to respond
This is repeated probably several hundred times for about 10 minutes until it finally loads the page; sometimes it doesn't even manage to load it at all.
On a Linux machine, it tries to start, then returns the following:
Exception in thread "thread1"
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: 'pangolin',
ip: '128.238.32.20', os.name: 'Linux', os.arch: 'amd64', os.version:
'2.6.32-39-generic', java.version: '1.7.0' 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:107)
at org.openqa.selenium.phantomjs.PhantomJSDriver.(PhantomJSDriver.java:96)
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: 'pangolin', ip: '128.238.32.20',
os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-39-generic',
java.version: '1.7.0' Driver info: driver.version: PhantomJSDriver
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:165)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:62)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527)
... 7 more Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting
for [http://localhost:16050/status] to be available after 20002 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:104)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:163)
... 9 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)
... 10 more Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:258)
at java.util.concurrent.FutureTask.get(FutureTask.java:119)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:130)
... 11 more
What am I doing wrong? I've read a lot about how Phantomjs is so much faster than the other drivers, and would really like to use it, but if it takes 10 minutes to load each page, that's obviously not feasible.
I am running Selenium WebDriver version 2.38.0 and Phantomjs version 1.9.2.
Thank you very much in advance,
bsg
EDIT
Just to clarify, I don't think this has anything to do with my code; the errors on Linux are being thrown on the line where I try to start the PhantomJS driver, below.
DesiredCapabilities caps = new DesiredCapabilities();
caps.setJavascriptEnabled(true);
caps.setCapability(
PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,
phantombinary//"/home/p/phantomjs-1.9.2-linux-x86_64/bin/phantomjs"
);
// Launch driver (will take care and ownership of the phantomjs process)
WebDriver driver = new PhantomJSDriver(caps);
System.out.println("starting driver");
If it is still not working for you on Linux, try below piece of code, it is working for me on Mac.
capabilities.setCapability("phantomjs.binary.path", "path of phantom binary/phantomjs")
org.openqa.selenium.remote.UnreachableBrowserException clearly something to do with Phantom. On Windows ensure Phantom is running (Set Environment variable and add PATH)
Check that Remote Machine hub address is correct and you should be able to run phantomjs.
Note: Selenium Server must be running on the desired remote machine.
DesiredCapabilities phantomBeast = DesiredCapabilities.phantomjs();
try {
webDriverInstance = new RemoteWebDriver(new URL(hubUrl), phantomBeast);
} catch (Exception e) {
//Do something
}