Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
496 views
by Contributing Tester (92 points)
edited by
I have set up the chrome driver path

D:\Projects\QA Automation\Main\DeBeers_Automation>set -Dchromedriver="D:\Projecs\QA Automation\Local Repository\org\seleniumhq\selenium\selenium-chrome-driver\2.53.1"

 

System.setProperty("webdriver.chrome.driver", "chromedriver");

 

This results into NullPointer Exception

java.lang.NullPointerException

at org.openqa.selenium.support.events.EventFiringWebDriver.extractInterfaces(EventFiringWebDriver.java:119)

at org.openqa.selenium.support.events.EventFiringWebDriver.<init>(EventFiringWebDriver.java:91)

at utility.TestListener.takeScreenShot(TestListener.java:68)

at utility.TestListener.onTestFailure(TestListener.java:59)

at org.testng.internal.Invoker.runTestListeners(Invoker.java:1686)

at org.testng.internal.Invoker.runTestListeners(Invoker.java:1670)

at org.testng.internal.Invoker.invokeMethod(Invoker.java:696)

at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)

at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)

at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)

***** Error LoginScript test has failed *****

at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)

java.lang.NullPointerException

at org.openqa.selenium.support.events.EventFiringWebDriver.extractInterfaces(EventFiringWebDriver.java:119)

at org.openqa.selenium.support.events.EventFiringWebDriver.<init>(EventFiringWebDriver.java:91)

at utility.TestListener.takeScreenShot(TestListener.java:68)

at utility.TestListener.onTestFailure(TestListener.java:59)

at org.testng.internal.Invoker.runTestListeners(Invoker.java:1686)

at org.testng.internal.Invoker.runTestListeners(Invoker.java:1670)

at org.testng.internal.Invoker.invokeMethod(Invoker.java:696)

at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)

at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)

at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)

at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)

java.lang.NullPointerException

at org.openqa.selenium.support.events.EventFiringWebDriver.extractInterfaces(EventFiringWebDriver.java:119)

at org.openqa.selenium.support.events.EventFiringWebDriver.<init>(EventFiringWebDriver.java:91)

at utility.TestListener.takeScreenShot(TestListener.java:68)

at utility.TestListener.onTestFailure(TestListener.java:59)

at org.testng.internal.Invoker.runTestListeners(Invoker.java:1686)

at org.testng.internal.Invoker.runTestListeners(Invoker.java:1670)

at org.testng.internal.Invoker.invokeMethod(Invoker.java:696)

at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)

at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)

at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)

at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)

java.lang.NullPointerException

at org.openqa.selenium.support.events.EventFiringWebDriver.extractInterfaces(EventFiringWebDriver.java:119)

at org.openqa.selenium.support.events.EventFiringWebDriver.<init>(EventFiringWebDriver.java:91)

at utility.TestListener.takeScreenShot(TestListener.java:68)

***** Error LoginScript test has failed *****

***** Error LoginScript test has failed *****

at utility.TestListener.onTestFailure(TestListener.java:59)

at org.testng.internal.Invoker.runTestListeners(Invoker.java:1686)

at org.testng.internal.Invoker.runTestListeners(Invoker.java:1670)

at org.testng.internal.Invoker.invokeMethod(Invoker.java:696)

at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)

at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)

at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)

at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)
selected by
 
Best answer

If you are using set you can do it as below.

 

D:\Projects\QA Automation\Main\DeBeers_Automation>set chromedriver="D:\\Projecs\\QA Automation\\Local Repository\\org\\seleniumhq\\selenium\\selenium-chrome-driver\\2.53.1\\chromedriver.exe"

 

And in the code, you can get it as below.

System.setProperty("webdriver.chrome.driver", System.getenv("chromedriver"));

 

You have to use -D in case of if you are passing it as a maven command argument as below.

>mvn clean test -Dchromedriver="D:\\Projecs\\QA Automation\\Local Repository\\org\\seleniumhq\\selenium\\selenium-chrome-driver\\2.53.1\\chromedriver.exe"

Hope this helps.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...