I’m using Serenity BDD with Appium v2.3.12 to automate a scenario that starts in a native Android app, opens Chrome to validate a form, and then returns to the native app for login.
I’m currently using serenity.properties
to configure Appium with UIAutomator2.
To switch to Chrome, I manually create a new AppiumDriver with browserName = Chrome
. This works fine, but the issue arises when switching back to the native context:
Using launchApp() or resetApp() causes driver failure, elements are no longer found, and getPageSource()
throws a WebDriverException
.
Quitting the original driver and trying to reuse it causes NoSuchSessionException
.
Creating a third AppiumDriver
works but breaks Serenity’s PageObject
mapping.
This switch works well on iOS, so I suspect UIAutomator2 and Serenity’s driver management might be the issue.
I’m looking for a clean way to switch contexts or drivers in Serenity so I can test both native and browser flows on Android without losing stability or PageObject
mapping.
Has anyone tackled this with Serenity BDD + Appium on Android?