如何使用Appium Python实现获取元素特定属性值的操作?
- 内容介绍
- 文章标签
- 相关推荐
本文共计185个文字,预计阅读时间需要1分钟。
使用`get_attribute()`获取元素属性,括号内应填写属性名。例如,查看appium源码,如果是获取resource-id,则填写`resourceId`。示例代码如下:
pythonself.driver.find_element(MobileBy.XPATH, //*[contains(@resource-id, 'followed_btn')]).get_attribute('resourceId')
使用get_attribute()获取元素属性,括号里应该填写什么?
查看appium源码
如果是获取resource-id,填写resourceId
self.driver.find_element(MobileBy.XPATH, "//*[contains(@resource-id,'followed_btn')]").get_attribute('resourceId')
如果是获取text,填写text,不是name,这是不准确吗?
self.driver.find_element(MobileBy.XPATH, "//*[contains(@resource-id,'followed_btn')]").get_attribute('text')
待探索
本文共计185个文字,预计阅读时间需要1分钟。
使用`get_attribute()`获取元素属性,括号内应填写属性名。例如,查看appium源码,如果是获取resource-id,则填写`resourceId`。示例代码如下:
pythonself.driver.find_element(MobileBy.XPATH, //*[contains(@resource-id, 'followed_btn')]).get_attribute('resourceId')
使用get_attribute()获取元素属性,括号里应该填写什么?
查看appium源码
如果是获取resource-id,填写resourceId
self.driver.find_element(MobileBy.XPATH, "//*[contains(@resource-id,'followed_btn')]").get_attribute('resourceId')
如果是获取text,填写text,不是name,这是不准确吗?
self.driver.find_element(MobileBy.XPATH, "//*[contains(@resource-id,'followed_btn')]").get_attribute('text')
待探索

