Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/305.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/4/algorithm/10.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_Iframe - Fatal编程技术网

Python Selenium在哪个iframe中?

Python Selenium在哪个iframe中?,python,selenium,iframe,Python,Selenium,Iframe,我如何才能签入我的驱动程序当前所在的iFrame?我在不同的iFrame中输入了多个函数-对于逻辑程序结构,我想在浏览器当前关注/定位的iFrame中实现一个安全检查,例如iFrame“香蕉”或“苹果” 我通过以下途径选择了这些: wait.until(EC.frame_to_be_available_and_switch_to_it((By.XPATH, "example_xpath"))) 选择等等是完美的工作。为了切换回“正常”的默认帧,我使用的是驱动程序。切换到.d

我如何才能签入我的驱动程序当前所在的iFrame?我在不同的iFrame中输入了多个函数-对于逻辑程序结构,我想在浏览器当前关注/定位的iFrame中实现一个安全检查,例如iFrame“香蕉”或“苹果”

我通过以下途径选择了这些:

wait.until(EC.frame_to_be_available_and_switch_to_it((By.XPATH, "example_xpath")))

选择等等是完美的工作。为了切换回“正常”的默认帧,我使用的是
驱动程序。切换到.default\u content()
,尽管我并不总是知道我在哪,所以问题就来了。

如果您想在UI上看到,可以使用javaScriptExecutor突出显示该帧。或者,您可以使用getAttribute()检查帧。您建议打印
print(driver.getAttribute())
?元素。获取属性(“属性名称”),您可以比较是否可以在iframe中找到元素。