Selenium常用定位方式

**基于div进行查找:
command:click;
target:xpath=//div[contains(text(),“003删除”)]/div/i[3]
target:xpath=//div[contains(text(),“003删除”)]
xpath=//div[contains(text(),‘多网点应用’)]

基于span进行查找:
command:click;
target:xpath=//span[contains(.,‘确认’)]
基于input/li查找:
xpath=(//li[@title=‘无工作台’])
xpath=(//input[@placeholder=‘请选择行政区划’])
拖动:
drag and drop to object
target:xpath=//tr[@class=‘next-table-row first’]
value:xpath=//tr[@class=‘next-table-row last’]
判断条件:
1、保存数据:
command:store xpath count
target:xpath=//h1[contains(.,‘浙江省政务服务2.0’)]
value:typeOne
2、判断上面保存的数据
command:if
target:${typeOne} == 1
3、执行操作
command:type
target:xpath=//input[@value=’’]
value: UI测试大厅-只读大厅
4、else
command:else
5、执行操作
command:click
target:xpath=//span[contains(.,‘郭’)]
6、end
command:end**

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值