0

Hi Please help me to fix this error I have created 2 packages one name as util another one is test to execute test scripts While executing util package class files in test package class Iam getting this error

an 24, 2023 2:44:50 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: W3C Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.openqa.selenium.WebDriver.close()" because "util.Apputils.driver" is null at util.Apputils.appClose(Apputils.java:17) at Testcase.userlogin.main(userlogin.java:10)

Iam expecting to give soultion to fix my problem

Bentaye
  • 9,403
  • 5
  • 32
  • 45
Ash Yeh
  • 1
  • 1
  • The exception message is clear: in your `AppUtils` class the field `driver` is null but you try to call `driver.close()`. Why is it null? Probably because you never initialize that field. – Thomas Kläger Jan 24 '23 at 09:50

0 Answers0