Skip to content

Comments

feat: add appium:ignoreWebviewBundleIds capability#2734

Open
sriteja777 wants to merge 1 commit intoappium:masterfrom
sriteja777:feat/ignore-webview-bundle-ids
Open

feat: add appium:ignoreWebviewBundleIds capability#2734
sriteja777 wants to merge 1 commit intoappium:masterfrom
sriteja777:feat/ignore-webview-bundle-ids

Conversation

@sriteja777
Copy link

@sriteja777 sriteja777 commented Feb 18, 2026

Problem

When getContexts() is called and no webview is loaded, the Web Inspector sometimes reports iOS system processes (e.g. com.apple.amsengagementd) in the app dictionary. These processes are not real webviews, but their presence prevents the selectApp() early-exit guard from triggering, causing the full retry loop to run — 20 retries × 500ms = ~10s — before returning an empty result.

Example log:

[RemoteDebugger] Current applications available:
    Application: "PID:88535"
        bundleId: "com.apple.amsengagementd"
        isActive: false
        isAutomationEnabled: "Unknown"
[RemoteDebugger] Trying out the possible app ids:  (try #1 of 20)
... (repeats 20 times)

Solution

Add a new appium:ignoreWebviewBundleIds capability. The value (string, JSON array, or native array) is parsed via parseCapsArray and passed to appium-remote-debugger as ignoreBundleIds. When all apps reported by Web Inspector match the ignore list, the retry loop is bypassed entirely and getContexts() returns immediately with only the native context.

Usage

"appium:ignoreWebviewBundleIds": ["com.apple.amsengagementd"]

Changes

  • lib/desired-caps.ts — Register capability (validated in validateDesiredCaps).
  • lib/driver.ts — Parse via parseCapsArray in validateDesiredCaps.
  • lib/commands/context.ts — Pass ignoreBundleIds to createRemoteDebugger.
  • docs/reference/capabilities.md — Document the new capability.

Dependency

Requires the corresponding ignoreBundleIds option in appium-remote-debuggerappium/appium-remote-debugger#480

Implements the ignoreWebviewBundleIds capability to address cases where iOS
system processes (e.g. com.apple.amsengagementd) are reported by the Web
Inspector but are not real webviews, causing getContexts() to spin for ~10s.

The capability value (string, JSON array, or native array) is parsed via
parseCapsArray and passed to appium-remote-debugger as ignoreBundleIds.
When all apps in the Web Inspector dictionary match the ignore list, the
retry loop is bypassed entirely and getContexts() returns immediately with
only the native context.

Docs updated in docs/reference/capabilities.md.
const baseOpts = {
bundleId: this.opts.bundleId,
additionalBundleIds: this.opts.additionalWebviewBundleIds as string[] | undefined,
ignoreBundleIds: this.opts.ignoreWebviewBundleIds as string[] | undefined,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where this option is implemented by the remote debugger?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have created a PR to add this option over there.

appium/appium-remote-debugger#480

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then we need to review and merge the other PR first. After the new version of the remote debugger that includes this feature is published you'd need to bump the minimum version of it in the package.json dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants