首页 技术 正文
技术 2022年11月12日
0 收藏 938 点赞 2,487 浏览 501 个字

示例简介:

要求:登录QQ邮箱,输入账号、密码

出现问题:页面中含有iframe框架,因此直接进行元素的查找与操作,出现找不到元素的现象,首先需进行iframe框架的转换,使用switch_to_frame,详细如下:

frame标签有 frameset、frame、iframe三种

1)frameset跟其他普通标签没有区别,不会影响到正常的定位

     2)frame与iframe对selenium定位而言是一致的,操作方式为;

1、切换到frame,switch_to_frame(reference),reference参数为:id/name/index等

2、 由frame切换到主文档:switch_to.default_content(),说明:切换到frame之后,不能继续操作主文档的内容,则需切回到主文档

3、嵌套frame的操作(switch_to.parent_frame())

driver.switch_to.frame(“frame1”)

driver.switch_to.frame(“frame2”)

4、由frame2切换到frame1,方法switch_to.parent_frame()

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,085
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,560
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,409
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,182
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,819
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,902