selenium2+Python3--frame框架
2017-09-20 本文已影响15人
少杰创业笔记
什么是frame(框架),其实就是一个网页里面嵌套另一个网页或者表单。
我们以腾讯课堂登录为例。

用法:driver.switch_to.frame('id_value')
一般是frame的id或name熟悉定位
这里我们用的是frame的name属性定位框架

这样,我们就成功的切换了frame框架,完成登录,就这么简单,是不是so easy

当然,如果,我们需要切换到原来的框架,进行定位
只需要输入:driver.switch_to.default_content()或driver.switch_to_default_content()就OK了
后者不建议使用,因为Python3已经开始不再维护switch_to_default_content。
