- appium@4.0.0-beta.4 - @appium/base-driver@11.0.0-beta.3 - @appium/base-plugin@4.0.0-beta.3 - @appium/docutils@4.0.0-beta.3 - @appium/driver-test-support@4.0.0-beta.3 - @appium/execute-driver-plugin@8.0.0-beta.4 - @appium/fake-driver@7.0.0-beta.4 - @appium/fake-plugin@5.0.0-beta.4 - @appium/http-server@1.0.0-beta.3 - @appium/images-plugin@6.0.0-beta.4 - @appium/logger@3.0.0-beta.2 - @appium/opencv@6.0.0-beta.3 - @appium/oxc-config@2.0.0-beta.2 - @appium/plugin-test-support@4.0.0-beta.4 - @appium/relaxed-caps-plugin@4.0.0-beta.4 - @appium/schema@2.0.0-beta.2 - @appium/storage-plugin@3.0.0-beta.4 - @appium/support@8.0.0-beta.3 - @appium/types@2.0.0-beta.3 - @appium/universal-xml-plugin@4.0.0-beta.4
@appium/universal-xml-plugin
Appium plugin for transforming platform-specific XML into a universal syntax
This plugin takes the XML page source retrieved using an iOS or Android driver, and changes various node and attribute names to use common terminology that can apply to both platforms.
Motivation
Having compatibility between iOS and Android XML sources can simplify creation of cross-platform tests.
Installation
appium plugin install universal-xml
Usage
Like all plugins, this plugin must be explicitly activated when launching the Appium server:
appium --use-plugins=universal-xml
Once the plugin is running, it will intercept and transform the app source retrieved by the Get Page Source command, as well as element node/attribute names provided in Find Element-related commands.
Turning translation off and on
Translation is on by default. To get the driver's original page source, or to run XPath queries
against the original node/attribute names, turn it off during a session with the
universalXml: setEnabled execute method,
and turn it back on the same way. universalXml: isEnabled returns the current state.
// WebdriverIO
await driver.executeScript('universalXml: setEnabled', [{enabled: false}]);
// page source and XPath queries are now passed through unchanged
await driver.executeScript('universalXml: setEnabled', [{enabled: true}]);
await driver.executeScript('universalXml: isEnabled', []); // true
The setting applies only to the current session. Every new session starts with translation on.
API
Refer to the Appium documentation.
Examples
Node names
| iOS | Android | Transformed |
|---|---|---|
XCUIElementTypeButton |
android.widget.Button |
Button |
XCUIElementTypeAlert |
android.widget.Toast |
Alert |
XCUIElementTypeSwitch |
android.widget.Switch |
SwitchInput |
See the mapping file for a full list of node name translations. Any names not specified are left as-is.
Attribute names
| iOS | Android | Transformed |
|---|---|---|
name |
content-desc |
axId |
label |
text |
text |
visible |
displayed |
visible |
Note that this plugin also removes a few attributes from the transformed XML. See the mapping file for a full list of attribute name translations and removed attributes. Any names not specified are left as-is.
License
Apache-2.0