selenium+python编写自动化脚本时,定位frame中对象操作

在web应用中经常会出现frame嵌套的应用,假设页面上有A,B两个frame,其中B在A内,那么定位B中的内容则需要先到A,再到B。switchTo().frame方法可以把当前定位的主题切换到frame里,在frame里实际是嵌套了另外一个页面,而webdriver每次只能在一个页面识别,所以需要用switchTo().frame方法去获取frame中嵌套的页面。

  • 退出 iframe 框架:driver.switch_to_default_content()
原文地址:https://www.cnblogs.com/tepy/p/10615125.html