天天看點

appium+python自動化:擷取元素屬性get_attribute

使用get_attribute()擷取元素屬性,括号裡應該填寫什麼?

檢視appium源碼

appium+python自動化:擷取元素屬性get_attribute
appium+python自動化:擷取元素屬性get_attribute

如果是擷取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')​

待探索