首页 > 其他 > 详细

通过索引点击元素

时间:2019-09-12 10:13:17      阅读:91      评论:0      收藏:0      [点我收藏+]

 

界面上有很多相同元素,通过索引点击对应的元素(如AAP上商品列表中的添加购物车按钮,点击指定商品的添加购物车按钮),可在..\AppiumLibrary\keywords\__element.py文件中添加如下代码:

def click_by_index(self, locator,index):
"""Click element identified by `locator` and `index`.

Key attributes for arbitrary elements are `index` and `name`.
See`introduction` for details about locating elements.
Args:
- ``locator`` - find elements by locator
- ``index`` - click the element with index
"""
self._info("Clicking element ‘%s‘." % locator)
self._element_find(locator, False, True)[int(index)].click()

通过索引点击元素

原文:https://www.cnblogs.com/luoww/p/11510219.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!