我的目标是访问链接列表(位于"event?id=85042")。
<tr class="gvrow"> == $0
<td>...</td>
<td>
<a href="event?id=85042"
text
</a>
</td>
...
这也会重复,所以我想获取位于 event?id=... 中的链接列表,我已经从这个问题Python Selenium - get href value尝试过这种方法,但它返回一个充满 None 的列表
primary_links = driver.find_elements_by_class_name('gvrow')
links = [elem.get_attribute('href') for elem in primary_links]
print(links)
输出:
[None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]
期望的输出:
['https://www.iccf.com/event?id=85042', 'https://www.iccf.com/event?id=79897', 'https://www.iccf.com/event?id=66745', ...]
那我该怎么办呢?
这是 html 的更好表示
湖上湖
相关分类