我对selenium和python还不熟悉,我想获得pdf。所以我试过了
driver = webdriver.Chrome(executable_path='/Users/mac/Downloads/chromedriver')
driver.get("https://google.com/search?query=" + searchList[i])
driver.find_element_by_css_selector("span.sFZIhb.b.w.xsm").click()
url = driver.current_url
print(url)
但这不会点击链接。pdf元素的范围是“跨度.sFZIhb.b.w.xsm“它标识但不单击链接。任何感谢帮助
基于@InfernO的XPath,这里有一个snip,它获取所有URL并单击第一个:
欢迎来到selenium有很多乐趣等着你!在
使用.pdf获取包含url的第一个链接并单击它。在
相关问题 更多 >
编程相关推荐