Selenium cannot find element by text via xpath

I am trying to click on the text that is inside the menu item (I cannot use the identifier of the menu item, as it is an asp.net web form menu that does not have client identifiers, therefore the identifiers are unreliable). Inside the table cell there is

<nobr>Revenue Object Maintenance</nobr>

However, if I do this:

selenium.Click("xpath=//nobr[text()='Revenue Object Maintenance'");

Selenium Errors:

ERROR: Invalid xpath [3]: XPath parse error //nobr[text()='Revenue Object Maintenance'

How can I click this nobr instance?

+3
source share
1 answer

if:

selenium.Click("xpath=//nobr[text()='Revenue Object Maintenance'"); 

Selenium Errors:

The error is obvious: you did not close the predicate .

This is a syntactically correct XPath expression :

//nobr[text()='Revenue Object Maintenance']
+2
source

Source: https://habr.com/ru/post/1780295/


All Articles