1

enter image description here

org.openqa.selenium.InvalidSelectorException: invalid selector: Unable to locate an element with the xpath expression //a[Contains(Text(),'Forgot Password?')] because of the following error: 
SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//a[Contains(Text(),'Forgot Password?')]' is not a valid XPath expression.

enter image description here

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • HTML is case-insensitive, but XPath is not, so while `//A[contains(text(),'Forgot Password?')]` can select anchor, `//a[Contains(Text(),'Forgot Password?')]` canNOT – Andersson Jan 16 '19 at 08:28

2 Answers2

3

you have messed up with the syntax or expression you have entered

//a[Contains(Text(),'Forgot Password?')]

this has to be like

//a[contains(text(),'Forgot Password?')]
akshay patil
  • 670
  • 7
  • 20
2

Error says it all, your xPath expression is not valid. You cannot change pre-defined keyword, like text() to Text(). Try //a[contains(text(),'Forgot Password')] or //a[contains(.,'Forgot Password')]

For more about InvalidSelectorException please refer this.

Sanjay Bhimani
  • 1,593
  • 1
  • 15
  • 29