feat: add appium:ignoreWebviewBundleIds capability#2734
Open
sriteja777 wants to merge 1 commit intoappium:masterfrom
Open
feat: add appium:ignoreWebviewBundleIds capability#2734sriteja777 wants to merge 1 commit intoappium:masterfrom
sriteja777 wants to merge 1 commit intoappium:masterfrom
Conversation
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, |
Contributor
There was a problem hiding this comment.
where this option is implemented by the remote debugger?
Author
There was a problem hiding this comment.
I have created a PR to add this option over there.
Contributor
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 theselectApp()early-exit guard from triggering, causing the full retry loop to run — 20 retries × 500ms = ~10s — before returning an empty result.Example log:
Solution
Add a new
appium:ignoreWebviewBundleIdscapability. The value (string, JSON array, or native array) is parsed viaparseCapsArrayand passed toappium-remote-debuggerasignoreBundleIds. When all apps reported by Web Inspector match the ignore list, the retry loop is bypassed entirely andgetContexts()returns immediately with only the native context.Usage
Changes
lib/desired-caps.ts— Register capability (validated invalidateDesiredCaps).lib/driver.ts— Parse viaparseCapsArrayinvalidateDesiredCaps.lib/commands/context.ts— PassignoreBundleIdstocreateRemoteDebugger.docs/reference/capabilities.md— Document the new capability.Dependency
Requires the corresponding
ignoreBundleIdsoption inappium-remote-debugger— appium/appium-remote-debugger#480