Appium中元素定位的注意点

应用场景

了解这些注意点可以以后在出错误的时候,更快速的定位问题原因。

示例

使用 find_element_by_xx 或 find_elements_by_xx 的方法,分别传入一个没有的"特征"会是什么结果呢?

核心代码

driver.find_element_by_id("xxx")

driver.find_elements_by_id("xxx")

小结

1.如果使用 find_element_by_xx方法,如果传入一个没有的特征,会报NoSuchElementException的错误。

2.如果使用 find_elements_by_xx方法,如果传入一个没有的特征,不会报错,会返回一个空列表

相关推荐
2601_967980115 天前
python+appium自动化测试如何控制App的启动和退出
android·自动化测试·python·appium·设备调试
2601_9679873724 天前
Python在自动化测试中有哪些应用?
python自动化测试·selenium·appium·pytest·性能测试
@zulnger1 个月前
安卓进行稳定性测试
android·appium·1024程序员节
2601_962298272 个月前
Python自动化脚本的编写01
python·appium·自动化脚本·web自动化·应收账款管理
2601_962078192 个月前
Appium+Python+pytest自动化测试框架详解
自动化测试·python·appium·pytest·移动应用
2601_962293532 个月前
Appium+python自动化(十二)- Android UIAutomator终极定位凶器(超详解)
android·自动化测试·appium·定位·uiautomator
weixin-a153003083163 个月前
7.Appium-ios端自动化
ios·appium·自动化
2601_962295993 个月前
Python+Appium 自动化测试:从基础语法到 PO 模式设计,构建稳定测试框架
自动化测试·python·appium·测试框架·po模式
测试19983 个月前
如何用appium搭建Android自动化测试框架?
自动化测试·软件测试·python·测试工具·职场和发展·appium·测试用例
St_rive3 个月前
Appium元素定位与常用方法
appium