Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.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 如何在selenium中关闭iframe_Python_Selenium_Webdriver_Selenium Chromedriver - Fatal编程技术网

Python 如何在selenium中关闭iframe

Python 如何在selenium中关闭iframe,python,selenium,webdriver,selenium-chromedriver,Python,Selenium,Webdriver,Selenium Chromedriver,因此,我正在从事一个Selenium webdriver项目,在其中一个过程中,我需要输入na iframe,然后向其中的输入发送键,但是,现在我想关闭或退出该iframe,以便可以单击该帧外的按钮,签出我的代码段: WebDriverWait(bot,20).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"iframe.top[title='Registration form']"))) W

因此,我正在从事一个Selenium webdriver项目,在其中一个过程中,我需要输入na iframe,然后向其中的输入发送键,但是,现在我想关闭或退出该iframe,以便可以单击该帧外的按钮,签出我的代码段:

WebDriverWait(bot,20).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"iframe.top[title='Registration form']")))
WebDriverWait(bot, 20).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="username"]'))).send_keys(self.usernameChar)
WebDriverWait(bot, 20).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="username"]'))).send_keys(Keys.RETURN)
你们能帮帮我吗? 注意:我的google版本是85

,要退出任何
,并将焦点设置在顶部浏览上下文上,您可以使用以下代码行:

driver.switch_to.default_content()

参考文献 您可以在以下内容中找到一些相关讨论: