c# - Find nth element by tag name within element found by ID using XPath or CssSelector -


i need grab third span element, inside element, inside li element has id. want use id first find li element, within that, find 3rd span element. html example:

<li id='myid'> <a href="myhref"> <span>first span</span> <span>second span</span> <span>third span</span> </a> </li> 

i tried following, dont think have written correctly:

public readonly menu_programmatchingnumber = by.xpath("li[@id='myid']/following-sibling::span[3]"); 

according xpath syntax:

http://www.w3schools.com/xml/xpath_syntax.asp

you may want use: //li[@id='myid']/a/span[3]

or more specific: //li[@id='myid']/a[@href='myhref']/span[3]


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -