Skip to content

feat(options): add missing Android, UiAutomator2, and Espresso capabilities - #2503

Open
hoanle0126 wants to merge 2 commits into
appium:masterfrom
hoanle0126:feat/android-driver-options-parity
Open

hoanle0126 wants to merge 2 commits into
appium:masterfrom
hoanle0126:feat/android-driver-options-parity

Conversation

@hoanle0126

@hoanle0126 hoanle0126 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Change list

Add typed option interfaces on UiAutomator2Options and EspressoOptions for capabilities supported by appium-android-driver and appium-uiautomator2-driver that did not have getters and setters yet.

Types of changes

  • No changes in production code.
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Details

Shared Android options added to both UiAutomator2Options and EspressoOptions:

  • ADB and server: adbListenAllNetwork, allowOfflineDevices, skipSettingsAppReinstall
  • App and device: dontStopAppOnReset, timeZone
  • Web context and BiDi: autoWebviewName, chromedriverForwardBiDi, chromedriverGrantPermissions, enableWebviewDetailsCollection

UiAutomator2-only options added to UiAutomator2Options:

  • enableAccessibilityEventsService (added in appium-uiautomator2-driver 9.1.0), forceAppLaunch, shouldTerminateApp
UiAutomator2Options options = new UiAutomator2Options()
        .autoWebview()
        .setAutoWebviewName("com.example.app")
        .enableBiDi()
        .chromedriverForwardBiDi()
        .disableWebviewDetailsCollection()
        .enableAccessibilityEventsService()
        .setTimeZone("America/New_York");

@mykola-mokhnach mykola-mokhnach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • [minor] The PR adds 11 interfaces and no BREAKING CHANGE. I found nothing breaking, only new default methods on the two options classes. A one-line check that no existing subclass or implementer already declares clashing method names would settle that.

String AUTO_WEBVIEW_NAME_OPTION = "autoWebviewName";

/**
* Sets a custom context name suffix to match instead of the application package

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[major] The driver doc defines autoWebviewName as replacing only the application package part of the context name. The driver builds the context name as WEBVIEW_ + (autoWebviewName || app package). The Javadoc here says "context name suffix" and "Custom webview context name". The tests pass "WEBVIEW_sample" and "WEBVIEW_espresso". A user following that pattern would make the driver look for WEBVIEW_WEBVIEW_sample, and autoWebview would never find the webview. Please reword the Javadoc to say the value replaces the package part (for example com.example.app). Also change the test values and the PR example to match.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated the Javadoc, unit tests, and PR snippet in 5a5d6ae to clarify that autoWebviewName replaces the application package part (for example com.example.app).

*
* @return self instance for chaining.
*/
default T enableWebviewDetailsCollection() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[minor] The driver default for enableWebviewDetailsCollection is true, so the no-arg enableWebviewDetailsCollection() changes nothing. The useful action is disabling it, which is only possible through setEnableWebviewDetailsCollection(false). Please state the default in the Javadoc. You could also drop the no-arg enabler, or add a disableWebviewDetailsCollection() helper.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Documented the true default and replaced the no-op enabler with disableWebviewDetailsCollection() in 5a5d6ae.

String CHROMEDRIVER_FORWARD_BIDI_OPTION = "chromedriverForwardBiDi";

/**
* Enables forwarding the ChromeDriver BiDi WebSocket to the driver WebSocket

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[minor] The driver requires BiDi to be enabled (webSocketUrl set to true, via enableBiDi()) for this capability to take effect. Calling only chromedriverForwardBiDi() gives no forwarding and no error. Please say so in the Javadoc. The driver docs also give 6.1.0 as the minimum driver version.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added the BiDi requirement (webSocketUrl: true / enableBiDi()) and minimum appium-android-driver 6.1.0 version to the Javadoc in 5a5d6ae.

String ENABLE_ACCESSIBILITY_EVENTS_SERVICE_OPTION = "enableAccessibilityEventsService";

/**
* Enables the Appium Settings accessibility events service for the session.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[nit] The driver docs say enabling this also stops suppressing accessibility services unless disableSuppressAccessibilityService is explicitly false. The minimum driver version (9.1.0) is only in the PR description. It would help to put both in the Javadoc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added both the disableSuppressAccessibilityService interaction and the minimum appium-uiautomator2-driver 9.1.0 version to the Javadoc in 5a5d6ae.

@hoanle0126

Copy link
Copy Markdown
Contributor Author

Thanks for the review @mykola-mokhnach. Addressed all inline notes in 5a5d6ae, and verified across src/ that none of the new method names clash with existing option classes or implementers.

This branch has not been deployed

No deployments
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