webdriver findelement by xpath <a> <span> C# -
i need create test in webdriver c# click link "text" in menu has structure this:
<ul style="overflow: hidden"> <li> <ul class"menu" style="overflow: hidden"> <li class="class_li"> <a href="/level1/leve2"> <span class="class_span">text</span> </a> </li> </ul> </li> <li /> <li /> </ul>
classes ""class_li" , "class_span" used many times. cannot modify html code.
i tried few different xpath statements everytime got "invalidselectorexception unhandled". how can link , click it?
the following xpath select first a
link has direct child span
text text
(//a[span/text()='text'])[1]
i'm no selenium expert, should able this:
driver.findelement(by.xpath("(//a[span/text()='text'])[1]")).click();
Comments
Post a Comment