我正在使用selenium浏览此页:
https://webapps.cityofchicago.org/activegcWeb/
但我找不到如何移动到任何页面,使用chrome,我在“下一步”按钮中得到了这个Xpath:
'//*[@id="id2"]/a[3]'
我使用的代码是:
url = 'https://webapps.cityofchicago.org/activegcWeb/'
driver_1 = webdriver.Firefox()
driver_1.get(url)
content = driver_1.page_source
next_button_xpath = '//*[@id="id2"]/a[3]'
button = driver_1.find_element_by_xpath(next_button_xpath)
button.click()
但我有个错误:
'selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"xpath","selector":"//*[@id=\"id2\"]/a[3]"}'
带有XPath定位器“//a[包含(@href,'标题页码:下一页“)]”,然后单击。你知道吗
只需通过链接文本找到下一个按钮:
完整的工作代码(包括窗口和等待):
相关问题 更多 >
编程相关推荐