【发布时间】:2018-12-30 20:34:00
【问题描述】:
运行代码时
def extract():
driver = webdriver.Firefox()
driver.get('http://example.com/')
while True:
elm = driver.find_element_by_link_text(">>").click()
elm.click()
if __name__ == '__main__':
extract()
页面加载并单击下一个按钮(链接)并加载下一页, 新加载的页面也有相同的链接按钮,但它没有点击 并且,
出现错误:
Traceback (most recent call last):
File "C:\Users\Admin\sel\click_next.py", line 14, in <module>
extract_top_news()
File "C:\Users\Admin\sel\click_next.py", line 11, in extract_top_news
elm.click()
AttributeError: 'NoneType' object has no attribute 'click'
这是我试图点击的链接按钮
<li>
<a href='http://example.com/page.php?page=2'>>></a>
</li>
我错过了什么!
【问题讨论】:
标签: selenium automation geckodriver