String is not a Valid Xpath Expression - Selenium Webdriver

Asked

Viewed 182 times

0

Hello,

I am using the following expression in xpath, but invalid xpath syntax error occurs. When I inspect the element in Mozilla’s firepath, it recognizes, but when running the test it fails.

Follows:

By.xpath("//*[@class='flaticon flaticon-Approval-Symbol-in-badge']//Ancestor::td//following-sibling::td/a[@ng-click='creatRascunho(v)']");

1 answer

0

really Selenium when you put this kind of xpath it error, a solution for Voce is to use the xpath that the firepath itself gives you, when you open the console and go in the fipath tab next to the name "firepath" will have an arrow down with the options you leave marked only the middle " Absolute xpath" then you go to the item you want right click and put specify by the firepath so it will already give you the expression ready for use in Selenium .

Browser other questions tagged

You are not signed in. Login or sign up in order to post.