0

Null pointer exception.

System.setProperty("webdriver.chrome.driver", System.getProperty("C:\\Users\\xxxxxx\\chromedriver_win32_2.1"));

ChromeDriver d1 = new ChromeDriver();

Hi All,

I am trying to automate ChromeDriver. But it is throwing this error. Can someone please help me?

2
  • 1
    please post the full stack trace Commented Jul 19, 2013 at 19:43
  • "C:\\Users\\xxxxxx\\chromedriver_win32_2.1" didn't you forget the .exe part? Did you unpack the .zip archive? Commented Jul 19, 2013 at 19:48

2 Answers 2

2
System.setProperty("webdriver.chrome.driver", System.getProperty("C:\\Users\\xxxxxx\\chromedriver_win32_2.1"));

This is flat-out wrong. It should be

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

Notice that I dropped the System.getProperty() call which did nothing (returned null) and I added \\chromedriver.exe to your path since you need to provide a full path with the exucutable included (and the downloaded .zip file unpacked).

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

Comments

0

It could be one of two things:

  1. One of your setProperty arguments are null (either the key doesn't exist/typo, or the getProperty doesnt exist/typo
  2. Your getProperty method is using only one argument, so the system is expecting this to be the key. I doubt your property key is going to be a full directory, so you'll need to use the double argument getProperty(key, value).

Source: Get/Set Property

Comments

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.