How can I create a single test with few changes between iOS,Android and Windows App?

Hi !
I’m tring to test my multiplatform app (Android,iOS,Windows App) with Appium.
I wrote the test code in java and currently this test work only on Android.
What do you suggest to write a single test that with few changes can works well on iOS,Android and Windows App ?

1- I have to instantiate a different driver in base of the platform under the test
2- I have to find the element on the screen, but on Android I found the element by id, on iOS and WIndows ??? In what way can i set the id on iOS and windows app ?
3- I have to write a different method to switch to webview context in base of the platform under the test

p.s : on windows in what way can I change to webview context ? Currently on UWP I can’t test the webview :confused:

Assuming your app looks and feels the same on both platforms, I would recommend adding an abstraction layer between the tests and appium that calls correct library.

If you implement the page/screen object model, you can have the pages objects handle this operation.

As for webview context, verify that your product has setWebContentsDebuggingEnabled set to true

1 Like

Thanks :slight_smile: I’m studying now the page/screen object model :slight_smile:
Off topic : are there some tutorial where is explained how to switch to webview context on window uwp ?

If you search this site you’ll find several discussions on it

On this site i have found much Android and iOS topic on webview, but currently I haven’t found a topic on UWP webview :frowning:

Try searching for setWebContentsDebuggingEnabled

@willosser Cuttently when I try to switch to webview context , the server gives to me this error :
> WinAppDriver::CommandHandler::Session::HandleCommandAsMidPoint - Command context is not recognized

Hopefully someone else will jump in here. We have never had web content debugging enabled, so I don’t have much help to offer on this topic


PageFactoryModel would be a good approach to write same scripts for multiple platforms. There might not be many resources available for windows unfortunately. Also please see that you use proper setup when working with multi pratform testing (example - on Windows machine, you can test only Android. But on Mac, you can test both Android and iOS). Not sure about Windows, as I haven’t worked on it yet.