You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Appium中忽略Raaga应用的选择账户弹窗?

Handling Raaga's Account Selection Popup in Appium

Hey there! I’ve run into exactly this kind of system-style account picker popup (just like Google Play’s) when automating apps before, so let’s walk through the most reliable ways to skip or ignore it in Appium.

Method 1: Leverage Appium’s Built-in Popup Handling Capabilities

For Android, you can configure your desired capabilities to auto-handle common system popups. These settings tell Appium to dismiss or accept non-critical alerts without manual intervention:

Python Example

desired_caps = {
    "platformName": "Android",
    "deviceName": "your_device",
    "appPackage": "com.raaga.android",
    "appActivity": "com.raaga.android.SplashActivity",
    "autoGrantPermissions": True,
    "ignoreUnimportantViews": True,
    "autoAcceptAlerts": True,  # Targets system-level alerts like account pickers
    "disableWindowAnimation": True  # Reduces flakiness when popups load
}

Java Example

DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("platformName", "Android");
caps.setCapability("deviceName", "your_device");
caps.setCapability("appPackage", "com.raaga.android");
caps.setCapability("appActivity", "com.raaga.android.SplashActivity");
caps.setCapability("autoGrantPermissions", true);
caps.setCapability("ignoreUnimportantViews", true);
caps.setCapability("autoAcceptAlerts", true);
caps.setCapability("disableWindowAnimation", true);

Method 2: Manually Locate and Dismiss the Popup

If the built-in settings don’t catch the popup, use Appium Inspector to identify the "Skip" or "Later" button (or any bypass option) and interact with it directly. This gives you precise control over the popup:

Python Example

from appium.webdriver.common.appiumby import AppiumBy
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException

try:
    # Wait up to 10 seconds for the popup to appear
    skip_button = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((AppiumBy.ID, "com.raaga.android:id/btn_skip"))
    )
    if skip_button.is_displayed():
        skip_button.click()
except TimeoutException:
    # Popup didn't load, proceed with your test
    pass

Java Example

import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.support.ui.ExpectedConditions;
import io.appium.java_client.AppiumBy;
import org.openqa.selenium.TimeoutException;

try {
    WebDriverWait wait = new WebDriverWait(driver, 10);
    MobileElement skipButton = wait.until(
        ExpectedConditions.presenceOfElementLocated(AppiumBy.id("com.raaga.android:id/btn_skip"))
    );
    if (skipButton.isDisplayed()) {
        skipButton.click();
    }
} catch (TimeoutException e) {
    // No popup detected, continue test execution
}

Pro tip: If it’s a system-level account picker (not part of Raaga’s UI), target elements using Android’s system package like com.google.android.gms instead.

Method 3: Launch the App Directly to the Main Activity

The account popup often only appears on the splash screen. Bypass it entirely by launching the app’s main home activity directly:

  1. First, find the main activity using ADB:
adb shell dumpsys window | grep mCurrentFocus
  1. Look for a line like mCurrentFocus=Window{... u0 com.raaga.android/com.raaga.android.ui.home.HomeActivity} — the part after the slash is your target activity.
  2. Update your desired capabilities to use this activity:
desired_caps["appActivity"] = "com.raaga.android.ui.home.HomeActivity"

Method 4: Use No Reset to Retain Session State

If you only need to dismiss the popup once, enable the noReset capability. This keeps the app’s state between test runs, so after you dismiss the popup once, subsequent launches won’t show it:

desired_caps["noReset"] = True

Note: This isn’t ideal for fresh test environments, but it’s a quick fix for recurring test runs.


I’d recommend starting with Method 1 or 3 since they’re the most maintainable. If those don’t work, Method 2 gives you full control over the popup. Let me know if you need help identifying specific elements!

内容的提问来源于stack exchange,提问作者Love

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 06:47:41