Reputation: 1
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?
Upvotes: 0
Views: 1805
Reputation: 38414
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).
Upvotes: 2
Reputation: 1931
It could be one of two things:
getProperty(key, value).
Source: Get/Set Property
Upvotes: 0