1、想要获取属性值,可以使用get_attribute
2、代码操作
#coding= utf-8 from appium import webdriver desired_caps = { 'platformName':"Android", 'deviceName':"R8V5T15930002010", 'platformVersion':"5.0.1", 'appPackage':"com.yuedan", 'appActivity':"com.yuedan.ui.Activity_Splash", 'unicodeKeyboard': True,#使用unicode编码方式发布字符串 'resetKeyboard': True #屏蔽软键盘 } driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps) # 等主页面activity出现,30秒内 ac = driver.current_activity print(ac) driver.wait_activity(".ui.Activity_Splash", 30) # 登录 driver.find_element_by_id("com.yuedan:id/login").click() text = driver.find_element_by_id('com.yuedan:id/btnPasswordLogin').get_attribute("text") print((text)) checkable = driver.find_element_by_id('com.yuedan:id/btnPasswordLogin').get_attribute("checkable") print((checkable))
运行结果: