我希望有一个善良的人能在这里帮助我。我需要帮助单击此网站上的下一页:https://www.xtip.co.uk/en/today/index.html。在
我的代码:
from selenium import webdriver
url = 'https://www.xtip.co.uk/en/today/index.html'
browser = webdriver.Chrome('./Browser/chromedriver')
browser.get(url)
amount_of_pages_xpath = browser.find_element_by_xpath('//*[@id="widget_today_tabbed"]/div[2]/div[2]/div')
amount_of_pages_html = amount_of_pages_xpath.get_attribute('data-number-of-pages')
for x in range(len(amount_of_pages_html)):
browser.find_element_by_xpath('//*[@id="widget_today_tabbed"]/div[2]/div[2]/div/ul/li[8]/a').click()
所以我不能使用Selenium页面来切换。我做错什么了?通常,当我转到Chrome->;Inspect->;Copy Xpath->;将此路径放入find_element_by_Xpath()和add click()时,它正常工作。在
我在控制台中的错误:
^{pr2}$
您可以使用以下代码:
相关问题 更多 >
编程相关推荐