当前使用Selenium + Python和以下代码:browser.get('http://www.google.com')search = browser.find_element_by_name('q')search.send_keys("how to search the internet")search.send_keys(Keys.RETURN) # hit return after you enter search texttime.sleep(5) # sleep for 5 seconds so you can see the resultsbrowser.execute_script("window.scrollTo(0, 873)") time.sleep(2)browser.find_element(By.XPATH, '(//h3)[3]/a').click()`作为我的代码。发生什么:转到Google并输入单词并点击搜索。向下滚动一点,然后点击第一个链接我想要的是:我希望能够从搜索结果页面中单击随机链接这该怎么做?编辑:这就是我说不必要时的意思:不必要的 1:https ://imgur.com/a/70qz89x不必要的2:https : //imgur.com/a/8WWvcnC这些是我想要的唯一结果:这个:https : //imgur.com/a/eTatFV9
添加回答
举报
0/150
提交
取消