我正在尝试寻找一个字符串。但似乎不起作用。
HTML:
<form name="form1" method="post" action="?cz=del&wbid=7683290543&zjt=aaa&lx=CNAME&xl=%C4%AC%C8%CF&fs=" onSubmit="return b_ifsf('delete?');" id="form1">
<td style="width:120px">
<input type="hidden" name="ip" value="aaa.xxx.com.a.bdydns.com." >
<input type="submit" name="rpt$btnDelete" value="delete" />
</td>
</form>
<form name="form1" method="post" action="?cz=del&wbid=2324242122&zjt=bbb&lx=CNAME&xl=%C4%AC%C8%CF&fs=" onSubmit="return b_ifsf('delete?');" id="form1">
<td style="width:120px">
<input type="hidden" name="ip" value="bbb.xxx.com.a.bdydns.com." >
<input type="submit" name="rpt$btnDelete" value="delete" />
</td>
</form>
<form name="form1" method="post" action="?cz=del&wbid=2324242553&zjt=ccc&lx=CNAME&xl=%C4%AC%C8%CF&fs=" onSubmit="return b_ifsf('delete?');" id="form1">
<td style="width:120px">
<input type="hidden" name="ip" value="ccc.xxx.com.a.bdydns.com." >
<input type="submit" name="rpt$btnDelete" value="delete" />
</td>
</form>
如何找到关键字bbb.xxx.com.a.bdydns.com.,然后点击提交删除?
最佳答案
@EVNRaja 的解决方案方向正确。
要找到文本bbb.xxx.com.a.bdydns.com。,然后单击value属性为删除的关联元素您可以使用以下任一解决方案:
使用xpath和
click()
:driver.find_element_by_xpath("//form[@id='form1' and @name='form1']//input[@name='ip' and @value='bbb.xxx.com.a.bdydns.com.']//following::input[1]").click()
使用xpath和
submit()
:driver.find_element_by_xpath("//form[@id='form1' and @name='form1']//input[@name='ip' and @value='bbb.xxx.com.a.bdydns.com.']//following::input[1]").submit()
关于python - 如何使用 python selenium find_element_by_xpath 找出上面的关键字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53576527/