I Need help in getting static text from Android (appium)application using java or python

I Need help in getting static text from Android (appium)application using java or python
i’ve used getText(),getAttibute() but no luck… help me with this … thanks.,.

Can some one please respond with the answer/ your comments…

with android app look at screen source and check that text you are looking for really exists and available to get it.

e.g.

way 1:

  • uiautomatorviewer

way 2:

  • with appium log “driver.getPageSource()”

@Aleksei Thanks for the replay … In here we are using the Application and that is not web view… correct me if i’m understanding in wrong way…
One more thing can you please provide the sample code how can we get the value in two ways…
Thanks in advance…

second way i said:
u may use e.g.: System.out.println(driver.getPageSource()) - and look into output (console…)

i will try wth the the second way . can you please help me with the [quote=“Aleksei, post:3, topic:13714”]
uiautomatorviewer
[/quote]

once again thanks for the quick replay

uiautomatorviewer is part of Android sdk. in mine case with mac it has default path in: /Users/Your_User_Name/Library/Android/sdk/tools/uiautomatorviewer

@Aleksei I am using the same tool, but in my case we are getting the result from server and displaying the result in UI as static text …
now I wanted to get that static test and print it to file… that is the problem i’m struck with…

then second way is only solution

@Aleksei thanks for the replay… will try and let you know what happened…

driver.find_element_by_id(“name_value”).get_attribute(“text”)

is working for me with python but the same code is not working… and coming to page source complete code came into xml format how to i get he text value for specific field. in java…

driver.findElement(MobileBy.id("id")).getAttribute("attr") driver.findElement(MobileBy.id("id")).getText()

1 Like

Now we will try with java and let you know what happens…
Thanks for the response …

once Again thank you soo much… it worked…

Can you please have a look at this issue also once :