0

I am trying to run my test cases on Chrome and I had copied the path in the Properties file,but still console is throwing annoying statements like: ERROR: The path to the chromedriver executable must be set by the webdriver.chrome.driver system property; for more information, see http://code.google.com/p/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://code.google.com/p/chromium/downloads/list FAILED CONFIGURATION: @BeforeTest startWebSession java.lang.NullPointerException

5 Answers 5

3

One thing I have found is that the Chrome driver cannot be started from within Eclipse. It must be run from a command prompt. At least on Windows 7 64-bit.

Trying to run it from within Eclipse produces this exception:

Exception in thread "main" java.lang.IllegalStateException: The webdriver.chrome.driver system property defined chromedriver executable does not exist: C:\Windows\System32\chromedriver.exe

This problem only occurs for Chrome. IE and FireFox work fine from within Eclipse.

Sign up to request clarification or add additional context in comments.

1 Comment

This might be the OS problem , I will update after trying the same.
2

Download the chrome driver from http://code.google.com/p/chromedriver/downloads/list

Initialize your driver object in the following manner -

System.setProperty("webdriver.chrome.driver","C:\\chromedriver.exe");

    WebDriver driver = new ChromeDriver();

By doing this the chrome driver works properly.

1 Comment

There are two ways to do this : one is the setProperty thing which is system based , which can be set by giving relativePath (Selenium provide it) like this for IEdriver and same will happen for chrome: code File file = new File("C:\\Documents and Settings\\tools\\iedriver_32\\IEDriverServer.exe"); System.setProperty("webdriver.ie.driver", file. getAbsolutePath()); WebDriver driver = new InternetExplorerDriver(); code Now another thing user can start thre driver from command prompt which Mike mentioned above .
0

This is how do I initialize the ChromeDriver:

public RegulationUI() throws Exception{
   ChromeDriverService service = ChromeDriverService.createDefaultService();
   File file = new File(RegulationUI.class.getResource("/chromedriver.exe").toURI());
   System.setProperty(ChromeDriverService.CHROME_DRIVER_EXE_PROPERTY, file.getAbsolutePath());                
   ChromeOptions options = new ChromeOptions();
   options.addArguments("--start-maximized");
   driver = new ChromeDriver(service,options);
}

BTW my test class is named RegulationUI

Try this, it works for me and moreover, I know that this is "multicomputer" solution - our project is in subversion and this way everybody can run it, even if we have differently setup where exactly on disk the "working folder" for IDE is

3 Comments

Hey Pavel ,I tried with:<pre><code>if (BrowserType.toLowerCase().equals("chrome")) { DesiredCapabilities chromecapabilities = DesiredCapabilities.chrome(); chromecapabilities.setCapability("chrome.binary", "C:/workspaceNewSFDC/HI_SalesForce"); ChromeDriverService service = new ChromeDriverService.Builder() .usingChromeDriverExecutable(new File("C:/workspaceNewSFDC/HI_SalesForce/chromedriver.exe")) .usingAnyFreePort() .build(); service.start(); driver = new ChromeDriver(service); } }
I have Java for this and am not good programmer, but: I believe the path should always contain also "chromedriver.exe" in it
I had already pasted the path of ChromeDriver.exe in my properties file.But every-time I run my Test-cases Console is throwing the same error!
0
    Please download chromedriver.exe for Google chrome browser 
    please download IEdriver.exe for Internet explore.

Please And kept these files in a root folder of windows for simplicity. Lets consider your operating systems installed on c:\ (C Driver) create a folder name Selenium on C-Drive and Kept these binary(.exe) files. like c:\selenium

    in your Testcase/testScript Write as 

    //For Chrome Browser:
    Webdriver driver = new ChromeDriver();
    java.io.File file = new File("c:\\selenium\\chromedriver.exe");     
    System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());

Comments

0

If you are using maven then try to use following in your pom:

    <dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>RELEASE</version>
    </dependency> 

and use it like this for chrome in your setup:

    ChromeDriverManager.getInstance().setup();
    driver = new ChromeDriver();

1 Comment

I have the same problem, getting a null.PointerException when I try to run Chrome in my IntelliJ IDE. I can run IE11 OK but not Chrome. I tried all of these suggestions in this thread but did not solve my problem. Here is how I'm currently configuring Chrome: ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.setBinary(RunConfiguration.getBrowserPath()); chromeOptions.addArguments("--ignore-certificate-errors"); System.setProperty("webdriver.chrome.driver", RunConfiguration.getBrowserDriverPath()); webDriver = new ChromeDriver(chromeOptions);}

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.