Max
Max

Reputation: 85

Run Appium tests against APP or IPA files?

I'm facing an issue in which I can't tap on some elements because they belong to a view/window that is on another layer of where the Appium driver operates. This would be solved if I could somehow change the focus to this new layer, like we do in Webdriver with the window handles methods.

I think I can workaround over this issue by executing my tests on the simulator (app file) instead of real device (ipa file) which led me to think. Is it a wrong approach to try to test on real device with ipa file?

I don't think so but that's what came to my mind after this situation.

Upvotes: 0

Views: 390

Answers (1)

Rajesh Chaudhary
Rajesh Chaudhary

Reputation: 112

What type of view it is ? In appium we have context concept.

When you are trying to interact with native component of any app in ios and android the it is known is native context and when elements are in any webview then it is webview context. You can get available context anytime using following code:

Set<String> contexts = driver.getContextHandles()

For example if you want to switch to webview then you can use following code:

Set<String> contexts = driver.getContextHandles();
for (String context : contexts) {
if (context.contains("WEBVIEW")) {
driver.context("WEBVIEW");
}
}

Upvotes: 1

Related Questions