-1

I'm facing an error:

java.lang.NullPointerException: Cannot invoke "org.openqa.selenium.WebDriver.findElement(org.openqa.selenium.By)" because "this.driver" is null

Code and Error screenshot:

code and error screenshot here

Can I know why I am getting this error?

I am trying to execute the script whose result should be printed as true, but gettting error.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • 1
    [Please do not upload images of code/data/errors.](//meta.stackoverflow.com/q/285551) – Joachim Sauer Feb 01 '23 at 11:53
  • Please read [ask], especially the part about [mcve] (MCVE). Take the code you are using, reduce it to an MCVE, and then post that code, properly formatted. Post the full error message, properly formatted, and indicate on which line the error is occurring. Post the relevant HTML, also properly formatted. – JeffC Feb 01 '23 at 17:07
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Feb 02 '23 at 19:01

1 Answers1

0

To use the By class you need to import By as follows:

import org.openqa.selenium.By;
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352