[SOLVED] XamarinUITest How to get text from alert pop up in android App


This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under
CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

Issue

Our application is built on xamarin form and I am performing xamarin UITest to automate the android native app.

Problem: During the validation I have to get the text from pop up box to compare with expected text

My approach: Using app.repl() I have identified the AppQuery of buttons in pop up and able to perform action on them(PFB Screenshot). But i am not ale to get the text of pop up message. Tried to use uiautomator to get identify the pop up elements but couldn’t identify the xpath

Expected Output: Please confirm that the following S-Number is correct: S855555

can someone please guide me on how to get the pop up text and validate in xamarin uitest.

enter image description here

enter image description here

Solution

In my case, below query is able to return the text from the screenshot

app.Query(x => x.Id(“scrollView”).Descendant().Id(“message”).Id(“message”).Invoke(“getText”))[0];

https://i.stack.imgur.com/s9so3.png

Answered By – nvbs

people found this article helpful. What about you?