Cannot find elements when the XPath expression is null.
When I use this,
It works fine for me.
But if I use the xpath,
It doesn’t and gives this error:
java.lang.IllegalArgumentException: Cannot find elements when the XPath expression is null
I can’t understand why i’m getting this error because I have used driver.findElement By.xpath so many times in my scripts and now I’m getting this error.
You need to put the xpath in the place driver.findElement(By.xpath(“your xpath”));
Else webdriver will not be able to locate the webelement.
If you are using properties file please check whether you have put in the xpath in the properties file.