简体   繁体   English

Python Selenium - 在没有下一步按钮的情况下单击页面

[英]Python Selenium - Clicking pages without next button

在此处输入图像描述 I would like to get info from multiple pages by clicking through them.我想通过点击从多个页面获取信息。 The problem is there is not next button and even though the page link contains a number for counting through, as you can see in the image below.问题是没有下一步按钮,即使页面链接包含一个用于计数的数字,如下图所示。

Can anyone help on how to solve this?任何人都可以帮助解决这个问题吗?

i=2
While True:
    try:
        #some wait
        driver.find_element_by_xpath("//a[@class='btn btn-primary spacebutton' and .='{}']".format(str(i+1))).click()
        i++
    except:
        break

Just loop through the a tags and click them based on their text.只需遍历 a 标签并根据其文本单击它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM