AnswerDroid
AnswerDroid

Reputation: 1893

How to detect change in view in appium(java) :android

I am automating test cases for android app using Appium (java). I am stuck on an interesting scenario:

My test case is to change the view of products by clicking on an icon.
That's done.
Now I need to verify that view has been changed or not, here is where the actual problem comes.
In both the cases the parent class is android.widget.GridView and subclass is android.widget.RelativeLayout
- only the the way they appear on screen is changed (First they appeared in list type and later in grid type).
I am using UIAutomator for UI elements.
How to detect this change?
Any help/ suggestion /work around would be greatful
UPDATE
I am attaching the screenshots of UI Automator.
Both the views

Upvotes: 2

Views: 2043

Answers (1)

Rohan
Rohan

Reputation: 859

You know the result view what you going to get. Just verify if that element is visible or not.

List<WebElement> view = driver.findElements(By.className("android.view.View"));
System.out.println(view);

if (view.size() > 0 || view != null) {
    viewFound = true;
} 

Upvotes: 0

Related Questions