Not able to run scripts in chrome browser

549 views
Skip to first unread message

gaurav garg

unread,
May 4, 2015, 8:06:52 PM5/4/15
to seleniu...@googlegroups.com
Hi,

I am trying to launch chrome browser using selenium webdriver but I am getting error while doing so.Not able to know the reason as I have downloaded latest Chrome driver 2.15 and given its correct path.I am using 64-bit Windows 7 OS.

Please suggest a solution of this.

Here is my code

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class chrome_test {
public static void main(String[] args) {
System.setProperty("WebDriver.chrome.driver","G:\\chromedriver.exe");
WebDriver driver =new ChromeDriver();
}
}

And getting below exception everytime I run this script

Exception in thread "main" 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://chromedriver.storage.googleapis.com/index.html

      at com.google.common.base.Preconditions.checkState(Preconditions.java:197)

      at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:110)

      at org.openqa.selenium.chrome.ChromeDriverService.access$0(ChromeDriverService.java:1)

      at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:118)

      at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:291)

      at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:82)

      at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:117)

      at selenium_demo.chrome_test.main(chrome_test.java:11)


Thanks

Gaurav 

Message has been deleted

Bhanu Prasad Sangita

unread,
May 5, 2015, 1:37:17 AM5/5/15
to seleniu...@googlegroups.com
Hi 
  
  It seems the path for chrome.exe is incorrect. Change the slashes( // ) and try 

Hope this helps you

Thanks,
S Bhanu Prasad.

The information in this message may be proprietary and/or confidential, and protected from disclosure. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify ATMECS and delete it from your computer.

murali seleniumtrainer

unread,
May 5, 2015, 2:22:14 AM5/5/15
to seleniu...@googlegroups.com
Hi,

Try with webdriver.chrome.driver and give correct chromedriver.exe location..

make sure that, that download exe file is not blocked.. mostly download files are blocked in my pc and i will un block from properties..

Let me know, still you are facing issue..

Thank You,
Murali

gaurav garg

unread,
May 5, 2015, 5:52:10 AM5/5/15
to seleniu...@googlegroups.com
Hi Bhanu and Murali,

Thanks for your reply.But I m still facing same issue after making all of your suggestions.

So please suggest me another solution regarding this.

Now my code is as below:

public class chrome_test {
public static void main(String[] args) {
System.setProperty("webDriver.chrome.driver","D:\\chromedriver.exe");
WebDriver driver =new ChromeDriver();
}

Can you suggest me certain checks on this so that I can be sure that I am not doing anything wrong here.


--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/a5795f26-470f-47ba-a50d-fb86eb5224ed%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Mercious

unread,
May 5, 2015, 6:05:44 AM5/5/15
to seleniu...@googlegroups.com
We cant know if the string is case-sensitive.

So please dont use webDriver.chrome.driver but instead use webdriver.chrome.driver. Try this first before further evaluating the problem.

A R K Satyanarayana Raju

unread,
May 5, 2015, 9:07:34 AM5/5/15
to seleniu...@googlegroups.com
Hi Gaurav,

'webdriver.chrome.driver' is very clear in error message. We should not use capital letters here.


On Tue, May 5, 2015 at 3:35 PM, Mercious <hart...@gmx.de> wrote:
We cant know if the string is case-sensitive.

So please dont use webDriver.chrome.driver but instead use webdriver.chrome.driver. Try this first before further evaluating the problem.

--
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.

For more options, visit https://groups.google.com/d/optout.



--
A R K Satyanarayana Raju

gaurav garg

unread,
May 5, 2015, 9:13:33 AM5/5/15
to seleniu...@googlegroups.com
Ok,I will try this and then let you know

Thanks

Anand Somani

unread,
May 5, 2015, 9:25:19 AM5/5/15
to seleniu...@googlegroups.com
public void beforeClass() {
        final String CHROME_LOCATION = "/src/testcases/chromedriver";
        System.out.println(System.
getProperty("user.dir") + CHROME_LOCATION);
        System.setProperty("webdriver.chrome.driver",
                System.getProperty("user.dir") + CHROME_LOCATION);
        driver = new ChromeDriver();
    }

It's require chromedriver binary file not exe file.

On 5 May 2015 at 18:53, Anand Somani <somani...@gmail.com> wrote:
public void beforeClass() {
        final String CHROME_LOCATION = "/src/testcases/chromedriver";
        System.out.println(System.getProperty("user.dir") + CHROME_LOCATION);
        System.setProperty("webdriver.chrome.driver",
                System.getProperty("user.dir") + CHROME_LOCATION);
        driver = new ChromeDriver();
    }

Attaching file ...


For more options, visit https://groups.google.com/d/optout.



--
~ Anand Somani



--
~ Anand Somani

Mercious

unread,
May 5, 2015, 10:04:50 AM5/5/15
to seleniu...@googlegroups.com
What are you talking about ...

gaurav garg

unread,
May 7, 2015, 7:51:45 AM5/7/15
to seleniu...@googlegroups.com
Hi A R K Satyanarayana Raju,

Thanks for reply,It resolves my issue.But now other issue came as below.So please suggest the proper solution for this.

Starting ChromeDriver 2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3) on port 8259
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited normally
  (Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 61.76 seconds
Build info: version: '2.45.0', revision: '32a636c', time: '2015-03-05 22:01:35'
System info: host: 'cstechadmin', ip: '192.168.5.100', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_40'
Driver info: org.openqa.selenium.chrome.ChromeDriver
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.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
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 selenium_demo.chrome_test.main(chrome_test.java:9)

Mercious

unread,
May 7, 2015, 8:20:46 AM5/7/15
to seleniu...@googlegroups.com
Are you using the appropiate bit-version of the chrome driver? 

If you are using a 64bit OS then use the 64bit ChromeDriver and vice versa.

Check that.

Krishnan Mahadevan

unread,
May 7, 2015, 9:19:12 AM5/7/15
to Selenium Users
@Mercious,

When it comes to Windows there is no 2 bitness flavors of chromedriver. there is only a 32bit chromedriver.

The stacktrace seems to suggest that Gaurav was perhaps working with a Windows box

Build info: version: '2.45.0', revision: '32a636c', time: '2015-03-05 22:01:35'
System info: host: 'cstechadmin', ip: '192.168.5.100', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_40'
Driver info: org.openqa.selenium.chrome.ChromeDriver

@Gaurav,

You seem to be working with Java 8. Would that be a problem ? A quick way to find out is to try and run a test with Firefox or InternetExplorer..

Your error stack trace also seems to suggest that the chromedriver may have perhaps come up, but something crashed it after that.

So first try to spawn the chromedriver manually. You should see an output as below 

krmahadevan@MYMACHINE ~  $ chromedriver
Starting ChromeDriver 2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf) on port 9515
Only local connections are allowed.

[Ignore the version, I am running on an older version ]

Then try loading the URL : http://localhost:9515/status [ Here 9515 should be replaced with the actual port number on which your chromedriver is listening to ]

If you see an output as below it basically confirms the fact that your chromedriver doesnt have any issues and the issue could perhaps be in your JDK.

{"sessionId":"","status":0,"value":{"build":{"version":"alpha"},"os":{"arch":"x86_64","name":"Mac OS X","version":"10.10.3"}}}











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/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
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.

A R K Satyanarayana Raju

unread,
May 11, 2015, 8:49:07 AM5/11/15
to seleniu...@googlegroups.com
What is u r chrome version?

May be problem with u r chrome driver. Download latest version from http://docs.seleniumhq.org/download/.


For more options, visit https://groups.google.com/d/optout.

John Farrar

unread,
May 12, 2015, 2:05:04 AM5/12/15
to seleniu...@googlegroups.com
I see that also, there appears to only be 32 bit drivers and my Chrome is 64bit now.
Reply all
Reply to author
Forward
0 new messages