[英]Use Selenium in Python 3.6 to click on 'Next page of results' button
I am trying to click the next button on this website ( https://www.ncbi.nlm.nih.gov/nuccore/?term=corn ) but cannot find the right terminology to use the Selenium toolset appropriately. 我试图单击此网站上的下一个按钮( https://www.ncbi.nlm.nih.gov/nuccore/?term=corn ),但是找不到正确使用Selenium工具集的正确术语。
Currently, my code is very bulky but this is the line I'm having issues with 目前,我的代码非常庞大,但这是我遇到的问题
browser.find_elements_by_xpath('//div[@class="pagination"] <THIS IS WHERE I NEED HELP!> )
Your xpath presently will select all divs with the class "pagination". 您的xpath当前将选择所有具有“ pagination”类的div。
To find the next page link, you can use the xpath //a[@title="Next page of results"]
要查找下一页链接,可以使用xpath
//a[@title="Next page of results"]
Your final code may end up looking like this: 您的最终代码可能看起来像这样:
browser.find_element_by_xpath('//a[@title="Next page of results"]').click()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.