I am trying to create a simple AWS based java selenium app.
I have installed java JDK, and google-chrome
I have created a sample app which runs fine from windows (with chrome-driver ofc)
But when I copy the code to AWS and try to run I always get this error.
Any idea how to solve this?
[root#ip-172-31-43-139 ec2-user]# java -version
java version "1.7.0_151"
OpenJDK Runtime Environment (amzn-2.6.11.0.74.amzn1-x86_64 u151-b00)
OpenJDK 64-Bit Server VM (build 24.151-b00, mixed mode)
[root#ip-172-31-43-139 ec2-user]# google-chrome --version
Google Chrome 60.0.3112.113
My sample code
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
WebDriver driver = null;
// System.setProperty("webdriver.chrome.driver", "chromedriver");
//Set up
ChromeOptions options = new ChromeOptions();
options.setBinary("/usr/bin/google-chrome");
options.addArguments("--headless");
options.addArguments("--disable-gpu");
options.addArguments("--screenshoot");
driver = new ChromeDriver(options); // dies here <-
driver.get("http://www.google.com");
//Tear down
driver.quit();
}
}
Console output:
Hello World!
/opt/google/chrome/google-chrome: symbol lookup error: /opt/google/chrome/lib/libgtk-3.so.0: undefined symbol: g_log_structured
Nov 06, 2017 1:44:12 PM org.openqa.selenium.os.UnixProcess checkForError
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 127 (Exit value: 127)
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.52.0', revision: '4c2593cfc3689a7fcd7be52549167e5ccc93ad28', time: '2016-02-11 11:22:43'
System info: host: 'ip-172-31-43-139', ip: '172.31.43.139', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.51-10.52.amzn1.x86_64', java.version: '1.7.0_151'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:665)
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:148)
at hu.csani.aws_test.App.setUp(App.java:33)
at hu.csani.aws_test.App.main(App.java:19)
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '2.52.0', revision: '4c2593cfc3689a7fcd7be52549167e5ccc93ad28', time: '2016-02-11 11:22:43'
System info: host: 'ip-172-31-43-139', ip: '172.31.43.139', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.51-10.52.amzn1.x86_64', java.version: '1.7.0_151'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:178)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:166)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:78)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644)
... 8 more
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:22678/status] to be available after 20005 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:107)
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:175)
... 11 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:80)
... 12 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)
... 13 more
The google-chrome works fine from terminal...
try to update your java to JAVA 8 (1.8)
faced same issue, but with slightly different error
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 139 (Exit value: 139)
Something were wrong with driver extraction from archive - right size is ~8MB
for failed
drwxrwxr-x 2 jenkins jenkins 4096 Mar 12 10:01 .
drwxrwxr-x 6 jenkins jenkins 4096 Oct 10 10:10 ..
-rwxrw-r-- 1 jenkins jenkins 1376159 Oct 10 10:10 chromedriver
for successful
drwxrwxr-x 2 jenkins jenkins 4096 Oct 10 10:11 .
drwxrwxr-x 7 jenkins jenkins 4096 Oct 10 10:11 ..
-rwxrw-r-- 1 jenkins jenkins 8950080 Oct 10 10:11 chromedriver
Related
I'm trying to install and run Selenium WebDriver using Java on a Mac. My favourite IDE is IntelliJ IDEA. When I try this:
public class TestImplWithoutWebDriverManager implements TestingConstants
{
static public void main(String... args)
{
String chromeDriverLibPath = "./lib/chromedriver";
File chromeDriverLib = new File(chromeDriverLibPath);
System.out.println(chromeDriverLib.exists());
System.out.println(chromeDriverLib.canRead());
System.setProperty("webdriver.chrome.driver", chromeDriverLibPath);
ChromeDriver chromeDriver = new ChromeDriver();
chromeDriver.navigate().to(MyTestHomePage);
}
}
I get this error message:
true
true
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:576)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:245)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:161)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:137)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:106)
at TestImplWithoutWebDriverManager.main(TestImplWithoutWebDriverManager.java:26)
Caused by: org.openqa.selenium.WebDriverException: Driver server process died prematurely.
Build info: version: '4.1.2', revision: '9a5a329c5a'
System info: host: 'Lemmis-MacBook-Pro-16.local', ip: '192.168.0.2', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '12.2.1', java.version: '1.8.0_312'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:226)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:98)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:558)
... 6 more
Process finished with exit code 1
... where the content of the .lib folder is:
-rwxr-xr-x# 1 lemmi staff 17775332 Jun 4 2013 chromedriver
-rwxr-xr-x# 1 lemmi staff 4261264 Sep 16 11:55 geckodriver
-rwxr-xr-x# 1 lemmi staff 18016880 Mar 10 08:06 msedgedriver
... what is exactly what I extracted from
-rw-r--r--# 1 lemmi staff 7614601 Mar 14 14:48 chromedriver_mac32.zip
-rw-r--r--# 1 lemmi staff 9886384 Mar 14 15:12 edgedriver_mac64.zip
-rw-r--r--# 1 lemmi staff 1854001 Mar 14 14:49 geckodriver-v0.30.0-macos.tar.gz
What am I missing out?
when I run selenium WebDriver driver = new FirefoxDriver () shows error, it imports all the libraries it requires but it still reproduces the error
package prueba;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Prueba {
public static void main(String[] args) {
WebDriver driver= new FirefoxDriver();
driver.get("https://www.google.com/");
}
}
when I run with Firefox driver () it shows the following error
1541445238209 Marionette DEBUG Remote service is active
1541445238216 Marionette DEBUG Accepted connection 0 from 127.0.0.1:51066
1541445238238 Marionette TRACE 0 -> [0,1,"newSession",{"acceptInsecureCerts":true,"browserName":"firefox","capabilities":{"desiredCapabilities":{"acceptInsecureCerts":true,"browserName":"firefox"}}}]
1541445238238 Marionette TRACE 0 <- [1,1,{"error":"unknown command","message":"newSession","stacktrace":"WebDriverError#chrome://marionette/content/error.js:178: ... et#chrome://marionette/content/server.js:245:8\n_onJSONObjectReady/<#chrome://marionette/content/transport.js:490:9\n"},null]
Nov 05, 2018 3:13:58 PM org.openqa.selenium.remote.ErrorCodes toStatus
INFO: HTTP Status: '404' -> incorrect JSON status mapping for 'unknown error' (500 expected)
Exception in thread "main" org.openqa.selenium.WebDriverException: newSession
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:14.666Z'
System info: host: 'Mac-mini-QE-Gustavo.local', ip: '192.168.1.73', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_131'
Driver info: driver.version: FirefoxDriver
remote stacktrace: stack backtrace:
0: 0x10a952f64 - backtrace::backtrace::trace::h381bd5461b44fdf8
1: 0x10a95331e - backtrace::capture::Backtrace::new::hbc1a12654c8fdba8
2: 0x10a87f2ad - webdriver::error::WebDriverError::new::h482125abced50b28
3: 0x10a88b11f - geckodriver::marionette::MarionetteSession::response::hc90b9b3424fb8183
4: 0x10a89828b - geckodriver::marionette::MarionetteConnection::send_command::he82b7344fb11a670
5: 0x10a889d38 - _$LT$geckodriver..marionette..MarionetteHandler$u20$as$u20$webdriver..server..WebDriverHandler$LT$geckodriver..marionette..GeckoExtensionRoute$GT$$GT$::handle_command::hf2128d0e5b79de64
6: 0x10a829be8 - _$LT$webdriver..server..Dispatcher$LT$T$C$$u20$U$GT$$GT$::run::h03cbe31ad3bffc79
7: 0x10a88004a - webdriver::server::start::_$u7b$$u7b$closure$u7d$$u7d$::h39b3aa32dda07c86
8: 0x10a87434a - _$LT$std..panic..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..FnOnce$LT$$LP$$RP$$GT$$GT$::call_once::hdf61d260d4895572
9: 0x10a7b8399 - std::panicking::try::do_call::h7b2d8948e219fc68
10: 0x10ade901a - __rust_maybe_catch_panic
11: 0x10a7b7eac - std::panicking::try::h91913aec898bbfef
12: 0x10a7b53c5 - std::panic::catch_unwind::h3ab5cba0644d3617
13: 0x10a7b717c - std::thread::Builder::spawn::_$u7b$$u7b$closure$u7d$$u7d$::h27cd13f9efbf7439
14: 0x10a812686 - _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::hc399e39818c3f4d8
15: 0x10ade51e4 - std::sys::imp::thread::Thread::new::thread_start::h36f6d218784ec55f
16: 0x7fff58dfa660 - _pthread_body
17: 0x7fff58dfa50c - _pthread_start
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 (RemoteWebDriver.java:142)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:98)
at prueba.Prueba.main(Prueba.java:23)
/Users/macminidev2/Library/Caches/NetBeans/8.2/executor-snippets/run.xml:53: Java returned: 1
BUILD FAILED (total time: 4 seconds)
could you help me with this problem please :D
This error message...
org.openqa.selenium.remote.ErrorCodes toStatus INFO: HTTP Status: '404' -> incorrect JSON status mapping for 'unknown error' (500 expected)
Exception in thread "main" org.openqa.selenium.WebDriverException: newSession
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:14.666Z'
System info: host: 'Mac-mini-QE-Gustavo.local', ip: '192.168.1.73', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_131'
Driver info: driver.version: FirefoxDriver
...implies that the GeckoDriver was unable to initiate/spawn a new WebBrowsing Session i.e. Firefox Browser session.
As you are using Selenium v3.x, ideally you should download the latest version of GeckoDriver from mozilla/geckodriver, extract and provide the absolute path of the GeckoDriver through the line System.setProperty() as follows:
System.setProperty("webdriver.gecko.driver", "/path/to/geckodriver");
However, your main issue is the incompatibility between the version of the binaries you are using as follows:
Your Selenium Client version is 3.8.1 of 2017-12-01T19:05:14.666Z which is almost a year older.
Your JDK version is 1.8.0_131 which is pretty ancient.
Your GeckoDriver version is unknown to us.
Your Firefox version is unknown to us.
So there is a clear mismatch between the JDK v8u131 , Selenium Client v3.8.1.
Solution
Upgrade JDK to recent levels JDK 8u191.
Upgrade Selenium to current levels Version 3.14.0.
Upgrade GeckoDriver to GeckoDriver v0.23.0 level.
GeckoDriver is present in the specified location.
GeckoDriver is having executable permission for non-root users.
Upgrade Firefox version to Firefox vv63.0.1 levels.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
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.
I think you are missing the following:
System.setProperty("webdriver.gecko.driver", firefox driver path);
I fixed this by downloading the latest version geckodriver-v0.26.0-win64\geckodriver.exe
Recently I upgraded to Selenium 3.7.
Code:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public static void main (String args[]){
System.setProperty("webdriver.gecko.driver",
"/usr/local/bin/geckodriver");
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
driver.quit();
}
Included Library:
selenium-java-3.7.1/selenium-server-standalone-3.7.1.jar
selenium-java-3.7.1/libs/httpcore-4.4.6.jar
selenium-java-3.7.1/libs/httpclient-4.5.3.jar
selenium-java-3.7.1/libs/guava-23.0.jar
selenium-java-3.7.1/libs/gson-2.8.2.jar
selenium-java-3.7.1/libs/commons-logging-1.2.jar
selenium-java-3.7.1/libs/commons-exec-1.3.jar
selenium-java-3.7.1/libs/commons-codec-1.10.jar
selenium-java-3.7.1/libs/byte-buddy-1.7.5.jar
selenium-java-3.7.1/client-combined-3.7.1.jar
selenium-java-3.7.1/client-combined-3.7.1-sources.jar
System environment:
Firefox 56.0.2
Java 1.8
selenium-java-3.7.1
selenium-server-standalone-3.7.1
geckodriver - v0.19.1
Error trace log:
Usage:
/usr/local/bin/geckodriver [OPTIONS] /usr/local/bin/geckodriver:
Unknown option --port=8970 Exception in thread "main"
org.openqa.selenium.WebDriverException:
org.apache.http.conn.HttpHostConnectException: Connect to
localhost:8970 [localhost/0:0:0:0:0:0:0:1,
localhost/fe80:0:0:0:0:0:0:1%1] failed: Connection refused (Connection
refused) Build info: version: '3.7.1', revision: '8a0099a', time:
'2017-11-06T21:07:36.161Z' System info: host:
'Maggies-MacBook-Pro-2.local', ip: '192.168.1.6', os.name: 'Mac OS X',
os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_121'
Driver info: driver.version: FirefoxDriver
Any idea would be appreciated. Thank you.
Update after trying Debanjan suggestion:
Code:
public static void main (String args[]){
System.out.println("Debug 1");
System.setProperty("webdriver.gecko.driver",
"/Users/maggie/Documents/ToolsQA/Libs/geckodriver");
System.out.println("Debug 2");
WebDriver driver = new FirefoxDriver();
System.out.println("Debug 3");
driver.get("http://www.google.com");
driver.quit();
}
Include Library:
selenium-server-standalone-3.7.1.jar
System Environment:
Firefox 56.0.2
Java 1.8
selenium-java-3.7.1
selenium-server-standalone-3.7.1
geckodriver 0.19.1
Mac OS X', os.arch: 'x86_64', os.version: '10.12.6'
Error trace log:
Debug 1 Debug 2 Starting ChromeDriver 2.33.506106
(8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2) on port 2198 Only local
connections are allowed. Exception in thread "main"
org.openqa.selenium.WebDriverException: Timed out waiting for driver
server to start. Build info: version: '3.7.1', revision: '8a0099a',
time: '2017-11-06T21:07:36.161Z' System info: host:
'Maggies-MacBook-Pro-2.local', ip: '192.168.1.6', os.name: 'Mac OS X',
os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_121'
Driver info: driver.version: ChromeDriver at
org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:192)
at
org.openqa.selenium.remote.service.DriverService.start(DriverService.java:178)
at
org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
at
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at
org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142)
at
org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:181)
at
org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:168)
at
org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123)
at AutomationFrameWork.FirstTestCase.main(FirstTestCase.java:13)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed
out waiting for [http://localhost:2198/status] to be available after
20005 ms at
org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
at
org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:187)
... 9 more Caused by: java.util.concurrent.TimeoutException at
java.util.concurrent.FutureTask.get(FutureTask.java:205) at
com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:147)
at
org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
... 10 more
The error WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:8970 can occur due to different reasons.
More over there is a discrepency in your Included Library list as selenium-server-standalone-3.7.1.jar is never a part of downloaded selenium-java-3.7.1.zip.
Try out the steps mentioned below:
From the Included Library list remove all the jars.
Download and Add only selenium-server-standalone-3.7.1.jar from this link or from this link
Ensure that /etc/hosts on your system contains the following entry :
1 127.0.0.1 localhost.localdomain localhost
Run CCleaner Tool to wipe away all the OS chores from your system.
You can opt for a System Reboot.
Execute your Test.
I tried with the same versions without any problem.
If the path to the geckodriver:
System.setProperty("webdriver.gecko.driver",
"/usr/local/bin/geckodriver");
is correct, make sure that the geckodriver is executable for the user that execute the code:
chmod +x geckodriver
After doing some research, I manage to resolve this problem.
The error is due to the 127.0.0.1 map to localhost.com in etc/hosts.
Edited:
127.0.0.1 localhost
I think you are missing the .exe extension. Your path should be like this
System.setProperty("webdriver.gecko.driver",
"/usr/local/bin/geckodriver.exe");
I've started using selenium over java in eclipse on linux (CentOS 6.6).
With Firefox everything works fine but with Chrome I'm getting:
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.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'localhost.localdomain', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-504.el6.x86_64', java.version: '1.7.0_79'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:665)
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 First.testGoogleSearch(First.java:24)
at First.main(First.java:18)
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'localhost.localdomain', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-504.el6.x86_64', java.version: '1.7.0_79'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:178)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:166)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:78)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644)
... 8 more
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:13244/status] to be available after 20001 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:107)
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:175)
... 11 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:80)
What I've tried:
Changing the SetProperty to path to real path instead of symlink.
That's following additional stack-overflow posts on the issue which suggested the above.
Installing a higher version of Java (using 1.7, installed 1.8).
That's my code, help would be appreciated:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
public class First {
/**
* #param args
* #throws InterruptedException
*/
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
testGoogleSearch();
}
public static void testGoogleSearch() throws InterruptedException {
//System.setProperty("webdriver.chrome.driver", "//home//shai//selenium//chromedriver");
System.setProperty("webdriver.chrome.driver", "//etc//alternatives//google-chrome");
WebDriver driver = new ChromeDriver();
driver.get("http://some url");
driver.quit();
}
}
There are various possibilities for this issue to occured.
Please check the chromedriver is whether 32 bit or 64 bit. It must match with your OS.
OR
It might be the because of folder permission. Please give execute permission to the folder where chromedriver is located.
I have a selenium code that uses chromedriver in windows. I have set the chromedriver using following:
ChromeDriverManager.getInstance().setup();
When i execute it in Windows, It works fine.
But when i create a jar for my code and execute it in unix using (java -cp xyz.jar classname). I get following error:
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 127 (Exit value: 127)
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.44.0', revision: '76d78cf323ce037c5f92db6c1bba601c2ac43ad8', time: '2014-10-23 13:11:40'
System info: host: 'sample.home.com', ip: '10.1.30.207', os.name: 'Linux', os.arch: 'amd64', os.version: '3.14.35-28.38.amzn1.x86_64', java.version: '1.7.0_75'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:593)
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:160)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:117)
at com.snapdeal.hadoop.monitoring.hdfs_monitoring.HadoopM.main(HadoopM.java:68)
Can someone please confirm what changes should be done in my script so that it can be run on unix machine?