Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用python单击iframe中的按钮_Python_Selenium_Selenium Webdriver_Css Selectors_Webdriverwait - Fatal编程技术网

使用python单击iframe中的按钮

使用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

我正在尝试使用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/'
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()