单击表行上的链接,该行在IDE中工作,但无法使用使用相同Xpath的Webdriver执行此操作

2024-09-25 16:23:37 发布

您现在位置:Python中文网/ 问答频道 /正文

使用以下代码在IDE中工作:

选择框:-

    <td>3</td>

//table[@id='HSS']/thead/tr/th[2]

但webdriver不适用于此

driver.switch_to_frame(3)
search_field=driver.find_element_by_xpath("//table[@id='HSS']/thead/tr/th[2]").click()

元素的HTML格式:

table id="HSS" class="menu_table"
<thead>
tr onclick="submitValue('HSS', 1);ems_create_node_menu_div();" style="cursor:pointer;"
class="menu_table_th" width="13%" colspan="1"
class="menu_table_th" width="36%" colspan="1">  HSS

Tags: 代码iddrivertableidewidthtrclass