1

There are elements with partial numeric values in id attribute. It was possible to verify the XPath syntax in the browser using //*[@id="text_12986"]

XPath does not work in the Selenium when "//*[@id='text_12986']" was used in the test script.

Element is not available is shown when the test is executed.

  • See if it's inside Iframe – PDHide Dec 29 '20 at 8:08
  • There could be reason, the numbers in ID is continuously changing on every page refresh. Create XPath by taking help of elements which are not dynamic. In your case id = text_12986 this 12986 may changes on page refresh. – Bharat Mane Dec 29 '20 at 8:12
  • 1
    Does this answer your question? How to handle dynamic changing ID's In XPath? – Bharat Mane Dec 29 '20 at 8:19
  • Could you please share any reference to the Html Code? – Mohamed Sulaimaan Sheriff Dec 29 '20 at 8:25
  • 1
    You may run the test in debug mode and check if the XPath syntax still work in the browser. Else get the page source and search for "text_12986" in the output. You may add System.out.println(driver.getPageSource().contains("text_12986")); before the element and confirm element exist. – Janesh Kodikara Dec 29 '20 at 9:15