简体   繁体   中英

How to get text from edittext or textview or button using android resource id in appium

I have a requirement where I should get the text from UI elements which change there value dynamically I have python interface written on top of appium to expose the functionality. But now I need to expose new Interface API to get value from Textview/EditText/Button. I just started using Appium. Hence tried googling the question but could not find a proper solution. Thanks if any one update's the same.

Assuming you already setup AndroidDriver, this will do the job in Java :

AndroidElement textView = (AndroidElement) AndroidDriver.findElementById("(resource_id>"); 
System.out.println(textView.getText());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM