Skip to content

Commit 75b4111

Browse files
fix: Get Context Handles Only in WebView Context to Avoid UnsupportedCommandException
1 parent f30abd8 commit 75b4111

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

utam-core/src/main/java/utam/core/selenium/appium/MobileDriverAdapter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,10 @@ final AppiumDriver switchToWebView(String title) {
100100
// For the Appium chromedriver limitation to handle multiple WebViews,
101101
// If switch to context fail to find the target WebView, then switch to
102102
// use window
103-
if (mobilePlatform == MobilePlatformType.ANDROID
103+
if ((mobilePlatform == MobilePlatformType.ANDROID
104104
|| mobilePlatform == MobilePlatformType.ANDROID_PHONE
105-
|| mobilePlatform == MobilePlatformType.ANDROID_TABLET) {
105+
|| mobilePlatform == MobilePlatformType.ANDROID_TABLET)
106+
&& !isNativeContext()) {
106107
Set<String> windowHandles = appiumDriver.getWindowHandles();
107108
for (String windowHandle : windowHandles) {
108109
if (!windowHandle.equals(NATIVE_CONTEXT_HANDLE)) {

0 commit comments

Comments
 (0)