This question already has answers here:
WebDriverException: unknown error: cannot find Chrome binary error with Selenium in Python for older versions of Google Chrome
(8 answers)
Closed 3 years ago.
I am trying open a google chrome using selenium webdriver but I'm getting the below error :
Starting ChromeDriver 2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb) on port 18885
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Windows NT 6.1.7600 x86) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 110 milliseconds
Build info: version: '3.141.5', revision: 'd54ebd709a', time: '2018-11-06T11:58:41'
System info: host: 'ADMIN-PC', ip: '192.168.244.1', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_191'
Driver info: driver.version: 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: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:123)
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:125)
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.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
at demo.main(demo.java:9)
I have tried everything but no use.
Below is my program :
public class demo {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","C:\\Users\\Admin\\Desktop\\Internal job application\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://google.com");
}
}
Need assistance on what action needs to taken
You are getting that error because your chrome browser is not installed in the default installation directory or selenium not able to find executable chrome browser file.
To solve this problem, you need to tell the program where your chrome browser executable is present and for that you can use ChromeOptions class like below :
public class demo {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","C:\\Users\\Admin\\Desktop\\Internal job application\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/chrome/binary"); // Provide absolute executable chrome browser path with name and extension here
WebDriver driver = new ChromeDriver(options);
driver.get("http://google.com");
}
}
I hope it helps...
Install Chrome browser in destination by default.
In this line:
System.setProperty("webdriver.chrome.driver", "destination to file"
destination to file is not destination to installed Chrome browser, but destination to downloaded here chrome driver.
Related
I am very new to selenium and trying to set up selenium in my laptop to begin. I am unable to invoke IE from my simple code. The details are given below. Can you please help me to understand where the issue is
IE version: IE 11,
IE Driver: 64-bit,
OS: Windows 10 64 bit,
Selenium version: 3.11
Error:
Started InternetExplorerDriver server (64-bit)
3.9.0.0
Listening on port 29313
Only local connections are allowed
Exception in thread "main" org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:29313
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:08.638Z'
System info: host: 'DESKTOP-B1D1PSJ', ip: '192.168.79.96', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161'
Driver info: driver.version: InternetExplorerDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:209)
at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:223)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:215)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:152)
at testing.Tryselenium.main(Tryselenium.java:31)
Caused by: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:29313
at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:240)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:158)
at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:256)
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:134)
at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:113)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
at okhttp3.RealCall.execute(RealCall.java:77)
at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:101)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:101)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
... 6 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at okhttp3.internal.platform.Platform.connectSocket(Platform.java:125)
at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:238)
Code:
mport java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
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.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
public class Tryselenium {
public static void main(String[] args) {
// TODO Auto-generated method stub
WebDriver web;
/*System.setProperty("webdriver.chrome.driver","C:\\Users\\Divakar\\Documents\\General\\Learnings\\Selenium\\Others\\Set Up files\\Browser Drivers\\" + "chromedriver_x32.exe");
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setExperimentalOption("excludeSwitches",Arrays.asList("test-type"));
web = new ChromeDriver(chromeOptions);
web.manage().window().maximize();
web.manage().timeouts().implicitlyWait(50,TimeUnit.SECONDS);*/
System.setProperty("webdriver.ie.driver","E:\\General\\Learnings\\Selenium\\Others\\Set Up files\\Browser Drivers\\" + "IEDriverServer.exe");
DesiredCapabilities capab = DesiredCapabilities.internetExplorer();
capab.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
web = new InternetExplorerDriver();
web.manage().window().maximize();
web.manage().timeouts().implicitlyWait(50,TimeUnit.SECONDS);
/*FirefoxDriver web = new FirefoxDriver();
web = new FirefoxDriver();
web.manage().window().maximize();
web.manage().timeouts().implicitlyWait(50,TimeUnit.SECONDS);*/
web.get("http://www.icicibank.com/");
web.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div/a[1]")).click();
web.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div/div[3]/div/ul[1]/li[1]/a")).click();
web.findElement(By.xpath("/html/body/div[1]/div[2]/div[2]/div/div[1]/div/div[3]/a")).click();
web.findElement(By.name("AuthenticationFG.USER_PRINCIPAL")).sendKeys("507133118");
web.findElement(By.name("AuthenticationFG.ACCESS_CODE")).sendKeys("Soft2008");
web.findElement(By.name("Action.VALIDATE_CREDENTIALS")).click();
web.findElement(By.id("ContentLink1")).click();
WebElement accttable = web.findElement(By.xpath("/html/body/form/div/div[3]/div[1]/div[4]/div[2]/div/div/div[5]/div/div/div/div/div/div/div"));
List<WebElement> all_rows = accttable.findElements(By.tagName("tr"));
int j = 0;
for (int i = 0; i < all_rows.size(); i++) {
List<WebElement> rowAllCells = all_rows.get(i).findElements(By.tagName("td"));
if(rowAllCells.size()>1)
{
String acctno=rowAllCells.get(2).getText();
if(rowAllCells.get(2).getText().trim().equalsIgnoreCase("602605049934"))
{
web.findElement(By.id("AccountSummaryFG.SELECTED_INDEX")).click(); ///html/body/form/div/div[3]/div[1]/div[4]/div[2]/div/div/div[5]/div/div/div/div/div/div/div/table/tbody/tr[4]/td[1]/input
web.findElement(By.id("HREF_actNicNameOutput[" + j + "]")).click();
web.findElement(By.id("backBtn")).click();
web.findElement(By.id("VIEW_MINI_STATEMENT")).click();
web.findElement(By.id("HREF_Logout")).click();
web.close();
}
else j = j + 1;
}
}
}
}
The error says it all :
3.9.0.0
Exception in thread "main" org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:29313
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:08.638Z'
System info: host: 'DESKTOP-B1D1PSJ', ip: '192.168.79.96', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161'
Driver info: driver.version: InternetExplorerDriver
It is clear from your error stack trace that the new session is not getting initiated and the driver.version is also not getting recognized.
Your main issue is the version compatibility between the binaries you are using as follows :
You are using Selenium Client v3.11.0
You are using IEDriverServer v3.9.0.0
You are using InternetExplorer v11.0 (as per your question)
So there is a clear mismatch between the Selenium Client v3.11.0 , IEDriverServer v3.9.0.0.
Solution
Upgrade IEDriverServer to v3.11.1.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
If your base Web Browser base version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Browser.
Execute your #Test.
Additional Considerations
You are using the flag INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true which is against the best practice. Don't do it.
This answer is updated for Edge Browser. If you are using Edge Browser and facing the same issue. Then follow the steps:
Download the latest IEDriverServer from this location : https://selenium.dev/downloads/
Update your code as follows :
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;
public class SL001_OpenWebpage_Edge
{
public static void main(String[] args)
{
System.setProperty("webdriver.ie.driver", "\\location\\IEDriverServer.exe");
WebDriver driver=new EdgeDriver();
driver.get("https://www.hul.co.in/");
driver.findElement(By.id("tcm:1255-50553-4")).click();
//driver.manage().window().maximize();
}
}
The issue in our case was not specific to Jenkins but the Chrome Driver crashing under the VMs where our automation tests run.
If you log into your VM machine and where your workspace have been copied into, and under the terminal run the same maven command you have on Jenkins you should be able to watch the tests run and this may be a way for you to identify and fix the issue.
I had this occur even with the same Driver and client versions.
Started InternetExplorerDriver server (32-bit)
3.141.59.0
...
java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:XXXX
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'HOST_NAME', ip: 'XX.XXX.XX.XX', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_251'
Driver info: driver.version: RemoteWebDriver
I ended up finding a perfect match here
http://selenium-release.storage.googleapis.com/index.html
but the Security Settings in IE were different and not correct on a new computer. Making each zone have the same Enable Protected Mode box state (every one selected or deselected) in
Internet Options -> Security
Fixed it 100%. Was getting the driver to launch and navigate to a page, but the prior two steps fixed the errors.
data:, shown in the chrome url bar when I execute the following Selenium ChromeWebdrive Script. Is the because other instance of chrome browser are working?
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class ChromWebdriverWindows {
public static void main(String[] args) {
//String url = "https://www.google.co.in/";
System.getProperty("webdriver.chrome.driver", "C:\\Automation\\chromedriver_win32\\chromedriver.exe");
WebDriver drive;
drive = new ChromeDriver();
drive.get("https://www.flock.co");
}
}
Getting this error in console:
Starting ChromeDriver 2.20.353145 (343b531d31eeb933ec778dbcf7081628a1396067) on port 7264
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.WebDriverException: java.net.SocketException: Connection reset
Build info: version: 'unknown', revision: '5234b32', time: '2017-03-10 09:00:17 -0800'
System info: host: 'MDVLFARZANS', ip: '192.168.0.106', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:91)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
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:178)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:167)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:124)
at ChromWebdriverWindows.main(ChromWebdriverWindows.java:10)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:139)
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:155)
at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:284)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:165)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:167)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:142)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:88)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:296)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:113)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
... 8 more
Your code looks fine just replace .getProperty() with .setProperty():
System.getProperty("webdriver.chrome.driver",
"C:\\Automation\\chromedriver_win32\\chromedriver.exe");
with
System.setProperty("webdriver.chrome.driver",
"C:\\Automation\\chromedriver_win32\\chromedriver.exe");
I have written the below code to capture the entire screen shot of a webpage using java script.
I'm Using:
Firefox Version: 49.0.1
Chrome Version: 54.0.2840.59 m
Selenium Version: 3.0.0
OS: Win10 64 bit
Java: 1.8
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class ScreenCapture {
public static void main(String[] args) throws IOException {
System.setProperty("webdriver.gecko.driver","C:\\Eclipse\\Drivers\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("https://www.flipkart.com/");
driver.manage().window().maximize();
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("window.scrollTo(0, document.body.scrollHeight)");
File capture = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(capture, new File("C:\\Users\\Vishvambruth JT\\Desktop\\FlipKart.jpg"));
}
}
The webpage will scroll down but the code stops abruptly with the below error. Could you please help.
1476679740598 geckodriver INFO Listening on 127.0.0.1:38310
Oct 16, 2016 11:49:00 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
1476679741083 mozprofile::profile INFO Using profile path C:\Users\VISHVA~1\AppData\Local\Temp\rust_mozprofile.h4P3qq7Ekmrz
1476679741083 geckodriver::marionette INFO Starting browser C:\Program Files (x86)\Mozilla Firefox\firefox.exe
1476679741083 geckodriver::marionette INFO Connecting to Marionette on localhost:50064
1476679742059 Marionette INFO Listening on port 50064
1476679743366 Marionette INFO startBrowser 6f833edf-0ff4-4f1f-869c-1de62f8626a9
Oct 16, 2016 11:49:03 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Exception in thread "main" org.openqa.selenium.WebDriverException: Permission denied to access property "H"
Build info: version: 'unknown', revision: '350cf60', time: '2016-10-13 10:43:56 -0700'
System info: host: 'LAPTOP-JUUNTJIC', ip: '10.0.0.112', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_101'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, marionette=true, firefoxOptions={args=[], prefs={}}, appBuildId=20160922113459, version=, platform=XP, proxy={}, command_id=1, specificationLevel=0, acceptSslCerts=false, processId=9960, browserVersion=49.0.1, platformVersion=10.0, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=firefox, takesScreenshot=true, takesElementScreenshot=true, platformName=windows_nt, device=desktop}]
Session ID: 6f833edf-0ff4-4f1f-869c-1de62f8626a9
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.executeScript(RemoteWebDriver.java:537)
at ScreenCapture.main(ScreenCapture.java:19)
I got the same error for Selenium Web Driver 3.0.1.
The problem was gone when switching to version 2.53.1.
I too got this issue and after some research, I can say it is not problem of Selenium. It is problem with gecko driver. You can run it with chrome and it will work fine.
Just update to Firefox Night and it will work.
The Firefox Night can be found at https://www.mozilla.org/en-US/firefox/channel/desktop/ (the one labeled Beta).
It's better to use an up-to-date webdriver version with an up-to-date Firefox Night version (all the code and efforts of development and code issues are focused on that synchronization, and of course it makes sense in order to cover newer final users scenarios better).
Environment- Firefox 48.0.2 and Selenium 3.0.0-beta2 versions ,i am getting below error -
1472824777259 Marionette INFO Listening on port 61096 [Child 5848]
WARNING: pipe error: 109: file
c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc,
line 343
[Child 4048] ###!!! ABORT: Aborting on channel error.: file
c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/ipc/glue/MessageChannel.cpp,
line 2046 Exception in thread "main"
org.openqa.selenium.remote.UnreachableBrowserException: Error
communicating with the remote browser. It may have died. Build info:
version: '3.0.0-beta2', revision: '2aa21c1', time: '2016-08-02
15:03:28 -0700' System info: host: 'VM7-JDB-068', ip: '10.60.88.67',
os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1',
java.version: '1.8.0_51' Driver info: driver.version: RemoteWebDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false,
marionette=true, appBuildId=20160823121617, version=, platform=XP,
proxy={}, command_id=1, specificationLevel=0, acceptSslCerts=false,
browserVersion=48.0.2, platformVersion=6.1,
XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=Firefox,
takesScreenshot=true, takesElementScreenshot=true,
platformName=Windows_NT, device=desktop}] Session ID:
499ab4bb-406d-4252-8b5d-808b22831595 at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:670)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:706)
at
org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:531)
at firefox_java.sample.main(sample.java:19) Caused by:
java.lang.IllegalStateException: UnixUtils may not be used on Windows
at
org.openqa.selenium.os.ProcessUtils.getProcessId(ProcessUtils.java:188)
at
org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.getPID(UnixProcess.java:222)
at
org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.access$300(UnixProcess.java:201)
at org.openqa.selenium.os.UnixProcess.destroy(UnixProcess.java:132)
at org.openqa.selenium.os.CommandLine.destroy(CommandLine.java:155)
at
org.openqa.selenium.remote.service.DriverService.stop(DriverService.java:196)
at
org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:94)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:649)
... 3 more on driver.quit();
Here is my Java code:
String marionetteDriverLocation = "\\Lib\\geckodriver.exe";
System.setProperty("webdriver.gecko.driver", marionetteDriverLocation);
WebDriver driver = new FirefoxDriver();
driver.get("https://www.google.co.in");
driver.quit();
Could you please help .
Thanks
Below is the working copy that I just now tried. If it doesn't work, then there should be problem with selenium jar or gecodriver.exe you are using.
public class MarrionateTest {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir") + "/BrowserDrivers/geckodriver.exe");
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setCapability("marionette", true);
WebDriver driver = new MarionetteDriver(cap);
driver.get("http://www.seleniumhq.org");
driver.close();
}
}
You have used MarionetteDriver but initializing FirefoxDriver().
Please try with WebDriver driver = new MarionetteDriver(cap); it should work.
Program:
Below given is the code snipped i'm tring to run. However it is failing to open the Chrome Browser. Browser just opens and closes in fraction of a secod with the below given exception in the console.
public static void main(String[] args) {
WebDriver driver = null;
//Map<String, Object> testDataMap = null;
try{
//testDataMap = LoadConfiguration.getTestDataMap();
System.setProperty("webdriver.chrome.driver","D:\\chromedriver_win32\\chromedriver.exe");
Thread.sleep(5000l);
driver = new ChromeDriver();
//driver = LoadConfiguration.getDriver();
System.out.println("Opening the Browser");
driver.get("http://localhsot:5080/myWebSite/8450191#");
Thread.sleep(2000l);
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");
if(null != driver){
driver.close();
driver.quit();
}
}
}
Exception:
Starting ChromeDriver (v2.9.248315) on port 13737
org.openqa.selenium.WebDriverException: unknown error: version info not a dictionary
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.99 seconds
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: org.openqa.selenium.chrome.ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
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.chrome.ChromeDriver.<init>(ChromeDriver.java:161)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:107)
at com.seic.scripts.TestScript.main(TestScript.java:24)
Quitting the Browser
OS: Windows 7, 64 bit
Browser Version: 21.0.1171.0
chromedriver=2.9.248315
Looks like old chrome version is causing this issue. Current chrome version is > 32. Update chrome and give a try.
Source