Selenium WebDriver - Chrome Issue - Not able to launch chrome browser- get an exception

22,936 views
Skip to first unread message

MRM

unread,
Jan 7, 2012, 4:11:29 AM1/7/12
to Selenium Users
Hi,

I have a piece of code which i am able to run it not IE anf FF
browsers using Selenium Webdriver 2.16.
I have chrome installed in the path "C:\Users\Dell\AppData\Local\Google
\Chrome\Application\chrome.exe"

Have downloaded chrome driver from and started the service.Chrome
Driver is in the path "C:\selenium
2\chromedriver_win_18.0.995.0"\chromedriver.exe.

When i try to create a instace of chrome browser i get an exception.

below is the code that i use

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


public class ChromeTest {
public static void main(String[] args) {

WebDriver driver = new ChromeDriver();
driver.get("http://www.google.com");

}
}


And the exception that i get is

Exception in thread "main" java.lang.IllegalStateException: 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
at com.google.common.base.Preconditions.checkState(Preconditions.java:
172)
at
org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:
103)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:
86)
at ChromeTest.main(ChromeTest.java:24)

Kindly let me know what am i missing here..

Thanks
MRM

Krishnan Mahadevan

unread,
Jan 7, 2012, 12:43:05 PM1/7/12
to seleniu...@googlegroups.com
Can you please retry adter you set the env variable which suggests as to where to find the chrome driver binary? For more infromation please refer to http://code.google.com/p/selenium/wiki/ChromeDriver
> --
> You received this message because you are subscribed to the Google Groups "Selenium Users" group.
> To post to this group, send email to seleniu...@googlegroups.com.
> To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.
>
>

--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

bis

unread,
Jan 7, 2012, 1:09:39 PM1/7/12
to seleniu...@googlegroups.com
or by looking on that page you can see this is possible

  DesiredCapabilities capabilities = DesiredCapabilities.chrome();
  capabilities
.setCapability("chrome.binary",
"C:\Users\Dell\AppData\Local\Google\Chrome\Application\chrome.exe");
 
WebDriver driver = new ChromeDriver(capabilities);

dreamboy

unread,
Jan 7, 2012, 10:03:57 AM1/7/12
to Selenium Users
HI

I am also facing same problem. Please reply to me if any solution
found for the below chrome driver question.

On Jan 7, 2:11 pm, MRM <meyya.a...@gmail.com> wrote:
> Hi,
>
> I have a piece of code which i am able to run it not IE anf FF
> browsers using Selenium Webdriver 2.16.
> I have chrome installed in the path "C:\Users\Dell\AppData\Local\Google
> \Chrome\Application\chrome.exe"
>
> Have downloaded chrome driver from and started the service.Chrome
> Driver is in the path "C:\selenium
> 2\chromedriver_win_18.0.995.0"\chromedriver.exe.
>
> When i try to create a instace of chrome browser i get an exception.
>
> below is the code that i use
>
>         import org.openqa.selenium.By;
>         import org.openqa.selenium.WebDriver;
>         import org.openqa.selenium.WebElement;
>         import org.openqa.selenium.chrome.ChromeDriver;
>
>         public class ChromeTest  {
>             public static void main(String[] args) {
>
>                 WebDriver driver = new ChromeDriver();
>                 driver.get("http://www.google.com");
>
>             }
>         }
>
> And the exception that i get is
>
> Exception in thread "main" java.lang.IllegalStateException: The path
> to the chromedriver executable must be set by the
> webdriver.chrome.driver system property; for more information, seehttp://code.google.com/p/selenium/wiki/ChromeDriver. The latest
> version can be downloaded fromhttp://code.google.com/p/chromium/downloads/list
>         at com.google.common.base.Preconditions.checkState(Preconditions.java:
> 172)
>         at
> org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeD­riverService.java:

Dragisa Krtolica

unread,
Jan 9, 2012, 5:12:47 PM1/9/12
to Selenium Users
download from here: http://code.google.com/p/chromium/downloads/list

let's say you installed in C:\chromeDriver

there should be chromedriver.exe inside folder

in your code do this:

WebDriver driver;

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

driver = new ChromeDriver();

Alex

unread,
Jan 9, 2012, 1:11:52 PM1/9/12
to seleniu...@googlegroups.com
Have you tried setting the system property to where the chrome driver executable is? For example, you would insert:

System.setProperty("webdriver.chrome.driver","*absolute path to executable*"); 

right above ChromeDriver cdrive = new ChromeDriver(); Be sure to fill in the absolute path to where the chrome driver executable is and not the chrome browser executable. 

Nitin Rajpal

unread,
Oct 24, 2012, 3:10:51 AM10/24/12
to seleniu...@googlegroups.com
Hi,

Below is my code:

System.setProperty("webdriver.chrome.driver", "E:\\Softwares\\chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
driver.get("http://www.google.com");

The errow log is :
Started ChromeDriver
port=
version=22.0.1203.0b
log=E:\Nitin\WorkSpace\SafariInSelenium\chromedriver.log
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.25.0', revision: '17482', time: '2012-07-18 21:09:54'
System info: os.name: 'Windows Vista', os.arch: 'x86', os.version: '6.0', java.version: '1.7.0_07'


Please help
> webdriver.chrome.driver system property; for more information, seehttp://code.google.com/p/selenium/wiki/ChromeDriver . The latest

Pushpraj Singh

unread,
Oct 24, 2012, 9:59:41 AM10/24/12
to seleniu...@googlegroups.com
My code is : nothing happens here :(

http://screencast.com/t/1WVMsVRZLgnY

package com.example.tests;


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


@SuppressWarnings("unused")
public class chrome_test  {

    public static void main(String[] args) {

        WebDriver driver;

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

Mark Collin

unread,
Jan 23, 2013, 10:32:57 AM1/23/13
to seleniu...@googlegroups.com
Well from a  quick glance:

\Workspace\TestApplication\  :\Workspace\chromedriver.exe

is not equal to:


C:\Users\Dell\AppData\Local\Google\Chrome\Application\chrome.exe

or:

C:\selenium 2\chromedriver_win_18.0.995.0"\chromedriver.exe

I would suggest setting

System.setProperty("webdriver.chrome.driver", "<locationOfChromeDriver>")

On 23/01/2013 15:17, jaspreet...@gmail.com wrote:
Tried every possible soln but still getting below error

Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: :\Workspace\TestApplication\  :\Workspace\chromedriver.exe
at com.google.common.base.Preconditions.checkState(Preconditions.java:176)
at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:117)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:112)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:69)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:107)
at Testing.main(Testing.java:11)


On Saturday, January 7, 2012 2:41:29 PM UTC+5:30, MRM wrote:
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/56MCCHuhfQwJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

venkatesh A

unread,
Jan 8, 2014, 1:35:27 AM1/8/14
to seleniu...@googlegroups.com
Install chrome Version 26.0.1410.64 m  its working for me .if i uninstall version 32 and install ver 26.



On Saturday, January 7, 2012 2:41:29 PM UTC+5:30, MRM wrote:

Shadaab

unread,
Jan 8, 2014, 3:56:57 AM1/8/14
to seleniu...@googlegroups.com
initiate the chrome browser first..
Add the below line in ur code.


System.setProperty("webdriver.chrome.driver", "path of crome.exe");

     WebDriver driver = new ChromeDriver(); 
                    driver.get("http://www.google.com"); 

Rgds
Shadaab


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.

ra cras

unread,
Jan 13, 2014, 9:03:00 AM1/13/14
to seleniu...@googlegroups.com
I want to use chrome, but the error appears below:

[TestNG] Running:
  C:\Users\Rafael\AppData\Local\Temp\testng-eclipse-1215559628\testng-customsuite.xml

FAILED CONFIGURATION: @BeforeMethod setUp
java.lang.IllegalStateException: The path to the driver 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/chromedriver/downloads/list
at com.google.common.base.Preconditions.checkState(Preconditions.java:177)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:105)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:75)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:107)
at postComments.PostCommentLinkVideo.setUp(PostCommentLinkVideo.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:653)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

SKIPPED CONFIGURATION: @AfterMethod tearDown
SKIPPED: PostCommentsAsGuest

how can I solve this?

Shawn McCarthy

unread,
Jan 13, 2014, 9:08:59 AM1/13/14
to seleniu...@googlegroups.com
As multiple people have pointed out, you need to give the location of the chromdriver (or put it in the PATH environment variable):
System.setProperty("webdriver.chrome.driver", "<locationOfChromeDriver>") // This is NOT the chrome.exe

ra cras

unread,
Jan 13, 2014, 9:18:44 AM1/13/14
to seleniu...@googlegroups.com
but I've added the path: http://screencast.com/t/YQcCIScRiWB3

Shawn McCarthy

unread,
Jan 13, 2014, 11:17:54 AM1/13/14
to seleniu...@googlegroups.com
You added it to a new environment variable called Chrome ? If so, that is not correct. You need to add it to the existing PATH environment variable. It is a semi-colon separated list.

ra cras

unread,
Jan 13, 2014, 3:16:50 PM1/13/14
to seleniu...@googlegroups.com
I did not understand

Shawn McCarthy

unread,
Jan 13, 2014, 3:43:58 PM1/13/14
to seleniu...@googlegroups.com
You made a new user variable called "Chrome". You should NOT have done this. Edit the existing PATH variable with the location of your chromedriver.exe .

ra cras

unread,
Jan 13, 2014, 3:59:27 PM1/13/14
to seleniu...@googlegroups.com
Yes, I add in PATH


Em segunda-feira, 13 de janeiro de 2014 14h17min54s UTC-2, Shawn McCarthy escreveu:

ra cras

unread,
Jan 14, 2014, 12:02:45 PM1/14/14
to seleniu...@googlegroups.com
still appears this error:

[TestNG] Running:
  C:\Users\Rafael\AppData\Local\Temp\testng-eclipse--286829347\testng-customsuite.xml

FAILED CONFIGURATION: @BeforeMethod setUp
java.lang.NullPointerException
at storeDesktop.PurchaseInStore1.setUp(PurchaseInStore1.java:26)
SKIPPED: PurchaseFuneralHome

===============================================
    Default test
    Tests run: 1, Failures: 0, Skips: 1
    Configuration Failures: 1, Skips: 1
===============================================


===============================================
Default suite
Total tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 1
===============================================

[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@3de5da76: 13 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@2646b10b: 7 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@63deebc8: 40 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@2c2c14f9: 11 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 7 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@107267a4: 27 ms



Em sábado, 7 de janeiro de 2012 07h11min29s UTC-2, MRM escreveu:

ra cras

unread,
Jan 15, 2014, 8:02:02 AM1/15/14
to seleniu...@googlegroups.com
My environment variable has been set, see: http://screencast.com/t/c50jPKBP7w4j but still appears error


Em sábado, 7 de janeiro de 2012 07h11min29s UTC-2, MRM escreveu:

Mohamed Amine Boubekri

unread,
Oct 8, 2014, 12:14:56 PM10/8/14
to seleniu...@googlegroups.com
Hi oscar,

can y please specify me when can i execute:


DesiredCapabilities capabilities = DesiredCapabilities.chrome();
  capabilities.setCapability("chrome.binary", "C:\Users\Dell\AppData\Local\Google\Chrome\Application\chrome.exe");
  WebDriver driver = new ChromeDriver(capabilities);

Thanks,
Med Amine
Reply all
Reply to author
Forward
0 new messages