【发布时间】:2020-09-16 11:52:24
【问题描述】:
您好,我正在尝试单击位于 <table> 和特定 <tr><td> 内的超链接,下面是 HTML 的样子
<tr><td>Clinic</td><td style="text-align:center">MN</td><td style="text-align:center"> </td><td style="text-align:center"><input type="hidden" name="3572" value="1"><input type="checkbox" name="Alert_3572" value="1" checked="true"></td><td style="white-space:nowrap;text-align:center;"><a href="muniInfo.jsp?OBLI=3572&current=FILING_HISTORY">Filing History</a></td><td style="text-align:center"></td></tr>
<tr><td>My Clinic</td><td style="text-align:center">MN</td><td style="text-align:center"> </td><td style="text-align:center"><input type="hidden" name="3540" value="1"><input type="checkbox" name="Alert_3540" value="1" checked="true"></td><td style="white-space:nowrap;text-align:center;"><a href="muniInfo.jsp?OBLI=3540&current=FILING_HISTORY">Filing History</a></td><td style="text-align:center"></td></tr>
我需要在这里做的是单击值 Clinic 的 <a href> 标记,但是根据 <td> = "Clinic 的值,不知道名称 (name="3572") 的值" 我需要用python点击相关的超链接
我能够使用美丽的汤检索所有 tr 和 td 标签,但不知道如何匹配值诊所,然后单击相邻的超链接。
我们将不胜感激。
【问题讨论】:
标签: html python-3.x selenium-webdriver web-scraping beautifulsoup