我想从中获取一些数据“https://www.techadvisor.co.uk/review/wearable-tech/". 我发现用Beautifulsoup循环浏览页面是不起作用的。这就是我试图用硒打开它的原因。无法找到克服GDPR阻止程序的“全部接受”按钮
我试过:
browser = webdriver.Chrome()
browser.get("https://www.techadvisor.co.uk/review/wearable-tech/")
# button = browser.find_element_by_xpath('/html/body/div/div[3]/div[5]/button[2]')
# WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.XPATH, "html/body/div/div[3]/div[5]/button[2]"))).click()
我总是不例外
老实说,我发现Xpath真的很奇怪,但我是从Google Chrome inspect得到的
感谢每一个解决方案建议或提示:)
我知道这个问题很老, 但我想提供我自己的解决方案! 第一步是识别您实际查看的表单的“id”,然后您需要将焦点转移到它上
单击
iframe
内的Accept All
按钮。需要先切换到iframe
才能单击该按钮诱导
WebDriverWait
()并等待frame_to_be_available_and_switch_to_it
()并使用以下css选择器诱导
WebDriverWait
()并等待element_to_be_clickable
()并使用以下xpath选择器相关问题 更多 >
编程相关推荐