使用python单击iframe中的按钮
我正在尝试使用python selenium访问网站。我要去一个我不能点击按钮的地方。需要帮忙吗? 请在下面找到我的代码:使用python单击iframe中的按钮,python,selenium,selenium-webdriver,css-selectors,webdriverwait,Python,Selenium,Selenium Webdriver,Css Selectors,Webdriverwait,我正在尝试使用python selenium访问网站。我要去一个我不能点击按钮的地方。需要帮忙吗? 请在下面找到我的代码: from selenium import webdriver from time import sleep path_to_chromedriver = "chromedriver.exe" driver = webdriver.Chrome(path_to_chromedriver) url = 'https://www.mail.com/' dr
from selenium import webdriver
from time import sleep
path_to_chromedriver = "chromedriver.exe"
driver = webdriver.Chrome(path_to_chromedriver)
url = 'https://www.mail.com/'
driver.get(url)
如何使用
css选择器单击按钮“同意并继续”
?元素同意并继续
存在于嵌套的
中。您需要先切换两个iframe,然后单击该元素
诱导WebDriverWait
()并等待frame\u可用,然后切换到\u it
()
诱导WebDriverWait
()并等待元素可点击()
您需要导入以下库
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
从需要使用的iframe跳出
driver.switch_to.default_content()
元素Agree and Continue
存在于嵌套的iframe
中。您需要先切换两个iframe,然后单击元素
诱导WebDriverWait
()并等待frame\u可用,然后切换到\u it
()
诱导WebDriverWait
()并等待元素可点击()
您需要导入以下库
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
从需要使用的iframe跳出
driver.switch_to.default_content()