vendredi 22 octobre 2021

Xpath code is working in Katalon but doesn't work in Selenium Java

I am using Katalon addon for Chrome which works fine. But I wanted to create small app with Selenium in Java to do simmilar thing. I am having the problem with xpath which is working with Katalon on chrome, but it is not working when I use it in my Java application in Selenium.

This it the xpath from Katalon:

xpath=(.//*[normalize-space(text()) and normalize-space(.)='Incorrect: Type your incorrect message here'])[1]/following::label[1]

And this is what I use with Selenium in Java:

WebElement el = driver_1.findElement(By.xpath("(.//*[normalize-space(text()) and normalize-space(.)=\'Incorrect: Type your incorrect message here\'])[1]/following::label[1]"));

It returns:

Exception in thread "AWT-EventQueue-0" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element:

Aucun commentaire:

Enregistrer un commentaire