简体   繁体   中英

selenium webdriver how to find stacked elements by name and xpath/tagname

I'm having a hard time understanding the webdriver, mainly because if you find by elements you cant transverse an element that way, it always appears to go back to the driver and not the element you're on.

I'm basically trying to find a table within an <a> with a name

Here is the html. There is several tables nested within a elements. So I want to try to find the <a> by name and then target the table

This is what i've tried driver.FindElements(By.XPath("//a[@name='description'] and //table")); but this cannot find the element

<a name="description"> <br><br><b><u>Case Description</u></b><br><br> <table> <tbody><tr valign="top"> <td>&nbsp;</td><td><b>Case ID:</b></td><td>&nbsp;CP5 - YOMI <i>-NON JURY TRIAL</i><br> </td></tr><tr valign="top"> <td>&nbsp;</td><td><b>Filing Date:</b></td><td>&nbsp;Friday , March 20th, 2009 </td></tr><tr valign="top"> <td>&nbsp;</td><td><b>Type:</b> </td><td>&nbsp;4A - DEBT </td></tr><tr valign="top"> <td>&nbsp;</td><td><b>Status:</b> </td><td>&nbsp;ENT </td></tr></tbody></table> </a>

// a [@ name ='description'] //表

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM