2

I am using chrome driver..

util

package util;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class DriverManager {
    public static WebDriver driver;
    String baseUrl="http://qmsadm.local";

    public DriverManager()
    {
        System.setProperty("webdriver.firefox.marionette","pathToGeckodriver");
        driver=new ChromeDriver();
        driver.get(baseUrl);
        driver.manage().window().maximize();
    }
}

Console error:

org.openqa.selenium.NoSuchSessionException: no such session (Driver info: chromedriver=2.10.267518,platform=Linux 4.4.0-47-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 84 milliseconds Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700' System info: host: 'naveen-Inspiron-3542', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-47-generic', java.version: '1.8.0_111' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{message=unknown error: unrecognized Blink revision: ed651c97177b2ac846b27f62bb8efed6dac0f90b (Driver info: chromedriver=2.10.267518,platform=Linux 4.4.0-47-generic x86_64), platform=ANY}] Session ID: c377f4dfc8dbecfa033afa8b8b90995a

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:216) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635) at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:322) at util.DriverManager.(DriverManager.java:19) at client.clientTest.initDriver(clientTest.java:18) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:100) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:216) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:143) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:307) at org.testng.SuiteRunner.run(SuiteRunner.java:270) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1284) at org.testng.TestNG.runSuitesLocally(TestNG.java:1209) at org.testng.TestNG.runSuites(TestNG.java:1124) at org.testng.TestNG.run(TestNG.java:1096) at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72) at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:124) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

Test ignored. =============================================== Default Suite Total tests run: 1, Failures: 0, Skips: 1 Configuration Failures: 1, Skips:

1

1
  • Please just do not copy paste code. Understand the configuration changes also. It would save your time.
    – Sagar007
    Dec 2, 2016 at 7:04

4 Answers 4

3

download chrome driver from this link https://chromedriver.storage.googleapis.com/index.html?path=2.25/ and write as below code:

public  static void setup(){
    System.setProperty("webdriver.chrome.driver", "E:\\Selenium \\chromedriver.exe");
    driver = new ChromeDriver();
    driver.manage().window().maximize();
}

it is working for me

6
  • Good answer but it is for windows. @AntonyNaveen can you please confirm it is Linux based system. As per your question stack trace.
    – Sagar007
    Dec 5, 2016 at 5:23
  • Sorry i dont hav eany idea for linux .but you can check techarena51.com/index.php/… this link
    – Rutvi Soni
    Dec 5, 2016 at 5:45
  • Rutvi , Your answer is absolutely correct for windows. I have already given answer based on Linux and it was corrected first. But I do not understand why @AntonyNaveen had changed. So I am confused about this action.
    – Sagar007
    Dec 5, 2016 at 5:49
  • @Sagar007 what's the problem? Simply download the Linux version of chromedriver and point it to your correct path (which you will have to do anyway, unless you want to create Selenium folder on your E: drive")
    – user36122
    Jan 22, 2019 at 10:47
  • @lostInCode Please try to understand problem. Question is about to solve on another OS. Each OS has different folder structure. Please refer : howtogeek.com/137096/…
    – Sagar007
    Jan 23, 2019 at 5:33
1

To avoid driver config issues in the future you can use WebdriverManager. read full info here: https://github.com/bonigarcia/webdrivermanager

you can replace the line

System.setProperty("webdriver.firefox.marionette","pathToGeckodriver");

with WebDriverManager.chromedriver().setup(); this is platform independent and will download the corresponding web driver binaries so you can leave out the configuration step in the future

you will need to import the WebDriverManger dependency

Assuming you are using maven in your project. add the following dependency within the parent <dependencies></dependencies> tags to your pom.xml file,

<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.2.0</version>
<scope>test</scope>
</dependency>
0

Please update chrome browser and download latest chromedriver from Download link

Extract the zip file

Put downloaded chromedriver at path /home/naveen/

For chrome driver use this System.setProperty("webdriver.chrome.driver", "/home/naveen/chromedriver");

2
  • i did same issue happens
    – user21268
    Dec 2, 2016 at 7:47
  • @user21268 Did the right answer solve issue ?
    – Sagar007
    Jan 23, 2019 at 5:34
0

In your code replace pathToGeckodriver with the actual path of the Chrome Driver exe.

Your code needs to find the Chrome Driver for it to be able to integrate and execute Chrome Driver's bit.

The path should be something like c:\Selenium\chromedriver.exe meaning the path to the exe file for Chrome Driver. If not sure just open the folder where you have placed the chromedriver.exe file on your computer, copy the path in the explorer's address bar and append the exe file's name to it when you paste it in your code.

For Ubuntu or any other Linux based system, you can find the path to the chromedriver shell script file and use that path without the .exe extension. It should be something like home/antony/chromedriver or the path whatever folder you have the chromedriver shell script file in.

You can download the Chrome Driver from here.

1
  • I am using ubuntu os I put this System.setProperty("webdriver.firefox.marionette", "home/naveen/chromedriver"); But still same error came..
    – user21268
    Dec 2, 2016 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.