1

When I try to use text in XPath, I am getting the error

org.openqa.selenium.InvalidSelectorException: Argument was an invalid selector (e.g. XPath/CSS). (WARNING: The server did not provide any stacktrace information)"

This is the code that i am trying to find an element

driver.findElement(By.xpath("//android.widget.EditText[@text=‘Enter recipient. Editing.’]")).sendKeys("8659741253");
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Ranjith Kasu
  • 72
  • 1
  • 11

2 Answers2

3

Problem is with the text editor. " ‘ " character is not the expected single quote . So use the normal " ' ". Hope this will work.

Pradeep hebbar
  • 2,147
  • 1
  • 9
  • 14
2

To send the text 8659741253 to the WebElement you can use the following line of code :

driver.findElement(By.xpath("//android.widget.EditText[contains(normalize-space(),'Enter recipient. Editing.')]")).sendKeys("8659741253");
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352