企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[//]: # "DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/mobile-command.yml" # 运行移动端的指令 运行一条本地移动端的指令 [//]: # "DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/mobile-command.yml" ## 使用示例 ```java // Java driver.executeScript("mobile: scroll", ImmutableMap.of("direction", "down")); ``` ```python # Python self.driver.execute_script("mobile: scroll", {'direction': 'down'}) ``` ```javascript // Javascript // webdriver.io example var result = browser.execute('mobile: scroll', {direction: 'down'}) // wd example await driver.execute('mobile: scroll', {direction: 'down'}); ``` ```ruby # Ruby # ruby_lib example execute_script("mobile: scroll", { "direction" => "down"}) # ruby_lib_core example @driver.execute_script("mobile: scroll", { "direction" => "down"}) ``` ```php # PHP // TODO PHP sample ``` ```csharp // C# driver.ExecuteScript("mobile:scroll", new Dictionary<string, string> { { "direction", "down" } }); ``` [//]: # "DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/mobile-command.yml" ## 描述 可执行多种本地移动端指令且通用的脚本语法是: `execute("mobile: <commandName>", <JSON serializable argument>)` (有关语法的更多详细信息,请参见[执行脚本]((../commands/web/execute.md))). 可用指令列表如下: ### IOS | 指令 | 描述 | 参数 | 参数示例 | | ------- | ----------- | -------- | ---------------- | | `mobile:viewportScreenshot` | 类似于[屏幕截图]((../commands/session/screenshot.md)),但仅包含当前视图窗口的内容 | <none> | <none> | ### IOS (只适用于 XCUITest ) | Command | Description | Argument | Argument Example | | ------- | ----------- | -------- | ---------------- | | `mobile:startPerfRecord` | 开始对被测设备进行性能分析 | <none> | | | `mobile:stopPerfRecord` | 停止对被测设备进行性能分析 | <none> | | | `mobile:startLogsBroadcast` | 启动IOS系统广播日志,输出地址为`/ws/session/:sessionId:/appium/device/syslog` | <none> | | | `mobile:stopLogsBroadcast` | 停止已启动的IOS系统广播日志 | <none> | | | `mobile:swipe` | 可以参考 [Automating Mobile Gestures For iOS With WebDriverAgent/XCTest Backend](../writing-running-appium/ios/ios-xctest-mobile-gestures.md#mobile-swipe) | | | | `mobile:scroll` | 可以参考 [Automating Mobile Gestures For iOS With WebDriverAgent/XCTest Backend](../writing-running-appium/ios/ios-xctest-mobile-gestures.md#mobile-scroll) | | | | `mobile:pinch` | 可以参考 [Automating Mobile Gestures For iOS With WebDriverAgent/XCTest Backend](../writing-running-appium/ios/ios-xctest-mobile-gestures.md#mobile-pinch) | | | | `mobile:doubleTap` | 可以参考 [Automating Mobile Gestures For iOS With WebDriverAgent/XCTest Backend](../writing-running-appium/ios/ios-xctest-mobile-gestures.md#mobile-doubleTap) | | | | `mobile:touchAndHold` | 可以参考 [Automating Mobile Gestures For iOS With WebDriverAgent/XCTest Backend](../writing-running-appium/ios/ios-xctest-mobile-gestures.md#mobile-touchAndHold) | | | | `mobile:twoFingerTap` | 可以参考 [Automating Mobile Gestures For iOS With WebDriverAgent/XCTest Backend](../writing-running-appium/ios/ios-xctest-mobile-gestures.md#mobile-twoFingerTap) | | | | `mobile:tapWithNumberOfTaps` | 可以参考 [Automating Mobile Gestures For iOS With WebDriverAgent/XCTest Backend](../writing-running-appium/ios/ios-xctest-mobile-gestures.md#mobile-tapWithNumberOfTaps) | | | | `mobile:tap` | 可以参考 [Automating Mobile Gestures For iOS With WebDriverAgent/XCTest Backend](../writing-running-appium/ios/ios-xctest-mobile-gestures.md#mobile-tap) | | | | `mobile:dragFromToForDuration` | 可以参考 [Automating Mobile Gestures For iOS With WebDriverAgent/XCTest Backend](../writing-running-appium/ios/ios-xctest-mobile-gestures.md#mobile-dragFromToForDuration) | | | | `mobile:selectPickerWheelValue` | 可以参考 [Automating Mobile Gestures For iOS With WebDriverAgent/XCTest Backend](../writing-running-appium/ios/ios-xctest-mobile-gestures.md#mobile-selectPickerWheelValue) | | | | `mobile:alert` | 可以参考 [Automating Mobile Gestures For iOS With WebDriverAgent/XCTest Backend](../writing-running-appium/ios/ios-xctest-mobile-gestures.md#mobile-alert) | | | | `mobile:installApp` | 可以参考 [XCUITest Mobile App Managemenet](../writing-running-appium/ios/ios-xctest-mobile-apps-management.md#mobile-installapp) | | | | `mobile:removeApp` | 可以参考 [XCUITest Mobile App Managemenet](../writing-running-appium/ios/ios-xctest-mobile-apps-management.md#mobile-removeapp) | | | | `mobile:isAppInstalled` | 可以参考 [XCUITest Mobile App Managemenet](../writing-running-appium/ios/ios-xctest-mobile-apps-management.md#mobile-isappinstalled) | | | | `mobile:launchApp` | 可以参考 [XCUITest Mobile App Managemenet](../writing-running-appium/ios/ios-xctest-mobile-apps-management.md#mobile-launchapp) | | | | `mobile:terminateApp` | 可以参考 [XCUITest Mobile App Managemenet](../writing-running-appium/ios/ios-xctest-mobile-apps-management.md#mobile-terminateapp) | | | | `mobile:activateApp` | 可以参考 [XCUITest Mobile App Managemenet](../writing-running-appium/ios/ios-xctest-mobile-apps-management.md#mobile-activateapp) | | | | `mobile:queryAppState` | 可以参考 [XCUITest Mobile App Managemenet](../writing-running-appium/ios/ios-xctest-mobile-apps-management.md#mobile-queryappstate) | | | | `mobile:setPasteboard` | 可以参考 [IOS Pasteboard Guide](../writing-running-appium/ios/ios-xctest-pasteboard.md#mobile-setpasteboard) | | | | `mobile:getPasteboard` | 可以参考 [IOS Pasteboard Guide](../writing-running-appium/ios/ios-xctest-pasteboard.md#mobile-getpasteboard) | | | | `mobile:installCertificate` | 可以参考 [IOS Pasteboard Guide](../writing-running-appium/ios/ios-xctest-install-certificate.md) | | | | `mobile:getContexts` | 获取有效的contexts, 以及与每个Webview关联的url和标题(请参阅 [获取context](../commands/context/get-contexts.md))。从Appium 1.17.0版本开始,如果 提供了 `waitForWebviewMs` , Appium 将会支持有效的时间内的等待来获取Webviews。 | `{waitForWebviewMs}` | `{waitForWebviewMs: 5000}` | | `mobile:batteryInfo` | 从被测设备读取电池信息 | <none> | <none> | | `mobile:pressButton` | 按下物理按钮。可用的按钮选项包括:主页,提高音量和降低音量。真实设备支持所有三个按钮,而模拟器仅支持主屏幕。 | `{name}` | `{name: "home"}` | | `mobile:enrollBiometric` | 使用 [生物传感器](https://developer.apple.com/design/human-interface-guidelines/ios/user-interaction/authentication/#face-id-and-touch-id) 打开(或关闭)IOS模拟器 | `{isEnabled}` | `{isEnabled: true}` | | `mobile:sendBiometricMatch` | 将匹配或不匹配的生物特征输入发送到IOS模拟器。 'type' 必须是 `touchId` 或者 `faceId`. Match是一个布尔值,指示它是匹配输入还是不匹配输入。 | `{type, match}` | `{type: "touchId", match: true}` | | `mobile:isBiometricEnrolled` | 检查是否已注册IOS模拟器。如果已注册,则返回true; 否则返回false。 ||| | `mobile:clearKeychains` | 清除IOS模拟器的密码钥匙 ||| | `mobile:siriCommand` | 向Siri发送命令 | `{text}` | `{text: "What time is it?"}` | | `mobile:source` | 该端点允许从WDA作为字符串(也位于Web上下文中)从WDA检索当前的本机页面源。可能的输出格式是: `xml` ( `getPageSource` 指令也是一样的), `json` (与xml格式相同的树结构,但表示为JSON) 和`description` ( 通过XCTest输出的本地调试). 可选的排除的Attributes数组允许提供属性名称,这些名称将从生成的xml树中排除。 这可能会显着提高页面源检索的性能,尤其是如果排除了visible属性。 | `{format, excludedAttributes}` | `{format: 'description'}` `{format: 'xml', excludedAttributes: ['visible']}` | | `mobile:activeAppInfo` | 获取当前活动应用程序的信息,例如bundleId和流程参数 | <none> | <none> | | `mobile:deviceInfo` | 获取设备信息,如语言环境和时区。时区默认为TZ数据库格式,例如America / New York,上一个为Apple名称,例如US / New York | <none> | <none> | | `mobile:rotateElement` | 将触摸两次的旋转手势发送到给定的元素。有关更多详细信息,请参见[rotate:withVelocity](https://developer.apple.com/documentation/xctest/xcuielement/1618665-rotate) | `{element, rotation, velocity}` | `{element: 2, rotation: π/2, velocity: 1.5}` | | `mobile:deleteFile` | 删除被测设备上的文件。远程路径值应符合 [Pushing/Pulling Files](../writing-running-appium/ios/ios-xctest-file-movement.md) | `{remotePath}` | `{remotePath: 'path/to/file'}` | | `mobile:deleteFolder` | 删除被测设备上的文件夹。远程路径值应符合 [Pushing/Pulling Files](../writing-running-appium/ios/ios-xctest-file-movement.md) | `{remotePath}` | `{remotePath: '@io.appium.example:documents/path/to/folder'}` | | `mobile:getPermission` | 获取模拟器上的应用程序权限状态。这个需要 https://github.com/wix/AppleSimulatorUtils ||| | `mobile:setPermission` | 从Xcode 11.4开始,需要通过`xcrun simctl privacy` 设置权限。`key`是`xcrun simctl privacy` 列表中的服务, `value` 是 `yes`(允许), `no`(撤销) or `unset`(重启).它适用于模拟器。 | `{bundleId, {key: value}}`| `{bundleId: 'io.appium.example', {'location-always': 'yes', calendar: 'no'}` | | `mobile:getAppearance` | 获取设备的UI外观样式通过 `xcrun simctl ui`. 它会返回 `light`, `dark`, `unknown` or `unsupported` ( IOS 12以下). ||| | `mobile:setAppearance` |设置设备的UI外观样式 通过`xcrun simctl ui` 或者siri 指令|`{style}`|`{style: 'dark'}`| | `mobile:getDeviceTime` | 获取被测设备的时间。 https://momentjs.com/docs/ 是受支持的日期时间格式说明符的完整列表。默认是ISO-8601的格式`YYYY-MM-DDTHH:mm:ssZ` | `{format}` | `{format: 'YYYY-MM'}` | | `mobile:startAudioRecording` | 开始录制音频流。阅读 [Audio Capture From iOS Simulators and Real Devices](../writing-running-appium/ios/audio-capture.md) 以获得更多细节 | | | | `mobile:stopAudioRecording` | 停止并存储录制的音频流。 阅读[Audio Capture From iOS Simulators and Real Devices](../writing-running-appium/ios/audio-capture.md) 以获得更多细节 | | | ### Android | 指令 | 描述 | 参数 | 参数示例 | | ------- | ----------- | -------- | ---------------- | | `mobile:shell` | 执行 [ADB shell](https://developer.android.com/studio/command-line/adb#shellcommands) 命令(需要启动[insecure feature](../writing-running-appium/security.md) `adb_shell` ) | 阅读 [this page](../writing-running-appium/android/android-shell.md) | `{'command': 'echo', 'args': ['arg1', 'arg2']}` | | `mobile:startLogsBroadcast` | 启动IOS系统广播日志,输出地址`/ws/session/:sessionId:/appium/device/logcat` | <none> | <none> | | `mobile:stopLogsBroadcast` | 停止已启动的IOS系统广播日志 | <none> | <none> | | `mobile:performEditorAction` | 在焦点输入字段上执行给定的编辑器操作。支持以下操作名称:`normal, unspecified, none, go, search, send, next, done, previous`. | `{action}` | `{action: "previous"}`| | `mobile:getPermissions` | 获取权限列表: `denied`, `granted` or `requested`. | `{type, appPackage}` | `{type: "granted", appPackage: "io.appium.android.apis"}`| | `mobile:changePermissions` | 授予或撤消权限。 | `{action, appPackage, permissions}` | `{action: "grant", appPackage: "io.appium.android.apis", permissions: "android.permission.READ_CONTACTS"}`, `{action: "revoke", appPackage: "io.appium.android.apis", permissions: ["android.permission.READ_CONTACTS", "android.permission.CAMERA"]}` | | `mobile:getNotifications` | 在状态栏通知中以JSON格式获取项目列表。 请通过“设置”>“应用和通知”>“特殊应用访问”打开“通知访问”(实际路径取决于设备型号)。请阅读[Appium Pro](https://appiumpro.com/editions/106-retrieving-status-bar-notifications-for-android-devices)以获得更多详细信息。 | <none> | <none> | | `mobile: listSms` | 以[JSON format](https://github.com/appium/io.appium.settings#sms)获取SMS消息列表. | <none> | <none> | | `mobile:type` | 将Unicode文本发送到焦点元素。 | `{text}` | `{text: "happy testing"}` | | `mobile:getDeviceTime` | 获取被测设备的时间。 https://momentjs.com/docs/ 是受支持的日期时间格式说明符的完整列表。默认是ISO-8601的格式`YYYY-MM-DDTHH:mm:ssZ` | `{format}` | `{format: 'YYYY-MM'}` | | `mobile:deleteFile` | 删除被测设备上的文件。远程路径值应为完整路径或应用程序ID的文件。 | `{remotePath}` | `{remotePath: '@io.appium.example/path/in/bundle'}`, `{remotePath: '/tmp/data/file'}` | | `mobile:startService` | 从Appium 1.18.0开始,通过调用am start-service或am start-foreground-service启动给定服务。 intent参数是强制性的。 user是应该为其启动服务的用户的ID(默认情况下使用当前用户ID)。如果前台设置为true,则该服务将在前台启动。 | `{intent, user, foreground}` | `{intent: 'my.app/my.activity', foreground: true}` | | `mobile:stopService` | 从Appium 1.18.0开始,通过在后台调用am stop-service停止给定服务。 intent参数是强制性的。 user是应该停止服务的用户的ID(默认情况下使用当前用户ID)。 | `{intent, user}` | `{intent: 'my.app/my.activity'}` | ### Android (UiAutomator2 only) | 命令 | 描述 | 参数 | 参数示例 | | ------- | ----------- | -------- | ---------------- | | `mobile:batteryInfo` | 从被测设备读取电池信息 | <none> | <none> | | `mobile:acceptAlert` | 接受屏幕弹窗 | 单击的可选按钮标签 | <none> | | `mobile:dismissAlert` | 取消屏幕上的警报 | Optional button label to click on | <none> | | `mobile:scrollBackTo` | 从一个元素滚动到另一个元素 | `{elementId, elementToId}` | `{elementId: 2, elementToId: 1}` | | `mobile:scroll` | 从Appium 1.18.0开始,滚动给定的可滚动元素,直到可以看到按策略和选择器指定的元素标识符为止。可选的max Swipes属性可以限制滚动动作的数量。它接受一个可选的元素属性,该属性应该是元素标识符并且可以滚动。如果没有此属性,Appium将选择第一个当前可用的可滚动容器。请阅读[appium-uiautomator2-driver](https://github.com/appium/appium-uiautomator2-driver/blob/master/lib/commands/general.js)中的“移动滚动”部分以了解更多详细信息 | `{element, strategy, selector, maxSwipes}` | `{strategy: 'accessibility id', selector: 'target content description'}` | | `mobile:viewportScreenshot` | 类似于[屏幕截图]((../commands/session/screenshot.md)),但仅包含当前视图窗口的内容 | <none> | <none> | | `mobile:viewportRect` | 返回自Appium 1.18.0开始的视图窗口的坐标和大小。返回类型是[general.js](https://github.com/appium/appium-uiautomator2-driver/blob/master/lib/commands/general.js)中定义的Rectangle。 | <none> | <none> | | `mobile:deepLink` | 打开深层链接URL 测试效果:[Instant Apps](https://support.google.com/googleplay/answer/7240211?hl=en) | `{url, package}` | `{url: "https://www.site.com/", package: "com.site.SomeAndroidPackage"}` | | `mobile:deviceInfo` | 获取设备信息,例如制造商,型号,时区和区域设置。阅读获取[GetDeviceInfo](https://github.com/appium/appium-uiautomator2-server/blob/master/app/src/main/java/io/appium/uiautomator2/handler/GetDeviceInfo.java)以获取更多详细信息。 | <none> | <none> | | `mobile:type` | 将给定的Unicode字符串键入焦点字段。 Unicode键盘功能和发送键的组合可替代文本字段内容。 W3C操作中的[send keys](https://appium.io../commands/element/actions/send-keys/)仅适用于ASCII。此命令可帮助此类情况将unicode文本内容附加到焦点字段中。 | `{text}` | `{text: 'happy testing'}` | ### Android (Espresso only) | 指令 | 描述 | 参数 | 参数示例 | | ------- | ----------- | -------- | ---------------- | | `mobile:swipe` | 执行 ["swipe" view action](https://developer.android.com/reference/android/support/test/espresso/action/ViewActions.html#swipeDown()) | `{element, direction}` | `{element: 2, direction: "down|up|left|right"}` | | `mobile:swipe` | 执行["GeneralSwipeAction"](https://developer.android.com/reference/androidx/test/espresso/action/GeneralSwipeAction) | `{element, swiper, startCoordinates, endCoordinates, precisionDescriber}` | `{element: 3, swiper: "FAST|SLOW", startCoordinates: 'BOTTOM_RIGHT', endCoordinates: 'TOP_RIGHT', precisionDescriber: 'FINGER'}` | | `mobile:clickAction` | 执行["ClickAction"](https://developer.android.com/reference/androidx/test/espresso/action/GeneralClickAction) | `{element, tapper, coordinatesProvider, precisionDescriber, inputDevice, buttonState}` | `{element: 2, tapper: 'Long', coordinatesProvider: 'BOTTOM_RIGHT', precisionDescriber: 'Thumb', inputDevice: 0, buttonState: 0}` | | `mobile:isToastVisible` | 检查是否有toast. 文本是必选参数。 Regexp是可选的。如果Regexp为true,则将文本解析为正则表达式模式。 is Regexp默认为false。如果文本存在,则返回true,否则返回false。 | `{text, isRegexp}` | `{ text: 'A toast' }`, `{ text: '^regex$', isRegexp: true } `| | `mobile:openDrawer` | 在[gravity](https://developer.android.com/reference/android/view/Gravity)作用下通过[DrawerAction](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions)打开抽屉。`gravity` is 可选的. 默认值为[GravityCompat.START](https://developer.android.com/reference/android/support/v4/view/GravityCompat.html#START). 此方法将阻塞直到抽屉完全关闭。如果抽屉已经关闭,则无法进行任何操作。 | `{element, gravity}` | `{ element: element_id }`, `{ element: element_id, gravity: 3 }` | | `mobile:closeDrawer` | 在[gravity](https://developer.android.com/reference/android/view/Gravity)作用下通过[DrawerAction](https://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions)关闭抽屉。`gravity` is 可选的. 默认值为[GravityCompat.START](https://developer.android.com/reference/android/support/v4/view/GravityCompat.html#START). 此方法将阻塞直到抽屉完全关闭。如果抽屉已经关闭,则无法进行任何操作。 | `{element, gravity}` | `{ element: element_id }`, `{ element: elementId, gravity: 3 }` | | `mobile:setDate` | 通过[PickerActions#setDate](https://developer.android.com/reference/android/support/test/espresso/contrib/PickerActions.html#setDate(int,%20int,%20int))#[DataPicker](https://developer.android.com/reference/android/widget/DatePicker)设置日期。 | `{element, year, monthOfYear, dayOfMonth}` | `{element: elementId, year: 2018, monthOfYear: 12, dayOfMonth: 1}` | | `mobile:setTime` | 通过 [PickerActions#setTime](https://developer.android.com/reference/android/support/test/espresso/contrib/PickerActions.html#setTime(int,%20int)) #[TimePicker](https://developer.android.com/reference/android/widget/TimePicker)设置时间。 | `{element, hours, minutes}` | `{element: elementId, hours: 12, minutes: 10}` | | `mobile:navigateTo` | 通过“[NavigationViewActions#navigateTo](https://developer.android.com/reference/android/support/test/espresso/contrib/NavigationViewActions.html#navigateTo(int))”导航到“[NavigationView](https://developer.android.com/reference/android/support/design/widget/NavigationView)”的操作。该视图必须是“导航视图”类型,在屏幕上可见并在屏幕上显示的“抽屉布局”的子级。 | `{element, menuItemId}` | `{element: elementId, menuItemId: 1}` | | `mobile:scrollToPage` | 通过[ViewPagerActions](https://developer.android.com/reference/android/support/test/espresso/contrib/ViewPagerActions)导航到[ViewPager](https://developer.android.com/reference/android/support/v4/view/ViewPager)。 `scrollTo` 必须是其中的一种 `first`, `last`, `left`, `right`. 如果提供了 `scrollTo` 和`scrollToPage` ,则 scrollTo是默认的 | `{scrollTo, scrollToPage, smoothScroll}` | `{element: elementId, scrollTo: 'left', smoothScroll: true}`, `{element: elementId, scrollToPage: 2}`| | `mobile:backdoor` | 调用Android应用中定义的任意方法。这些方法必须在Java中是公共的,并且必须在Kotlin中是开放的。 您要调用的方法`target` 是 `activity`, `application` 或者 `element`. `methods` `element` 是必须的如果`target` 是 `element`.在[here](https://github.com/appium/appium-espresso-driver/blob/master/lib/commands/general.js)阅读移动后门方法的文档字符串以获取更多详细信息 | `{target, methods, element}` | `{target: 'activity', methods: [{name: 'method1'}, {name: 'method2', args: [{value: 'hello appium', type: 'java.lang.String'}] }] }`, `{target: 'element', element: elementId, [{name: 'getTypeface'}, {name: 'isItalic'}]}` | | `mobile:flashElement` | 在屏幕上闪烁一个元素,以可视方式确认您正在使用正确的元素。可以选择设置持续时间Millis(以毫秒为单位)并重复动画计数 | `{element, durationMillis, repeatCount}` | `{element: "1234-abcd-5678", durationMillis: 1000, repeatCount: 10}` | | `mobile:uiautomator` | 使用uiautomator2 API进行多进程测试。策略可以是以下之一: "clazz", "res", "text", "textContains", "textEndsWith", "textStartsWith","desc", "descContains", "descEndsWith", "descStartsWith" and "pkg", taken from uiautomator [By class](https://developer.android.com/reference/androidx/test/uiautomator/By). `action` 可以是以下之一: "click", "longClick", "getText", "getContentDescription", "getClassName","getResourceName", "getVisibleBounds", "getVisibleCenter", "getApplicationPackage","getChildCount", "clear", "isCheckable", "isChecked", "isClickable", "isEnabled","isFocusable", "isFocused", "isLongClickable", "isScrollable" and "isSelected", taken from uiautomator [UiObject2](https://developer.android.com/reference/androidx/test/uiautomator/UiObject2). `index`是可选的,如果未给出,将返回所有匹配结果 | `{strategy, locator, index, action}` | `{strategy: 'clazz', locator: 'android.widget.TextView', index: 2, action: "getText"}` | | `mobile:webAtoms` | 运行一连串的[webatoms](https://developer.android.com/training/testing/espresso/web)与Element和perform是基本的链项目。请参考[issue](https://github.com/appium/appium-espresso-driver/pull/380)和[Sample test code](https://github.com/appium/ruby_lib_core/blob/c9062c4b744263d790c7de17263cbd4645cdefc6/test/functional/android/android/mobile_commands_test.rb#L196-L239)作为参考。 | `{webviewElement, forceJavascriptEnabled, methodChain}` | (webdriverio) `{ webviewElement: webviewEl.value, forceJavascriptEnabled: true, methodChain: [...]}` | | `mobile:dismissAutofill` | 在Android O +中禁用自动填充对话框 | `{element}` | `{element: elementId}` | | `mobile:deviceInfo` | 获取设备信息,例如制造商,型号,时区和区域设置。 阅读[GetDeviceInfo](https://github.com/appium/appium-espresso-driver/blob/master/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetDeviceInfo.kt) 获取更多细节。 | <none> | <none> | [//]: # "DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/mobile-command.yml" ## 支持 [//]: # "DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/mobile-command.yml" ### Appium Server |平台|Driver|Platform Versions|Appium Version|Driver Version| |--------|----------------|------|--------------|--------------| | iOS | [XCUITest](../drivers/ios-xcuitest.md) | 9.3+ | 1.6.0+ | All | | | [UIAutomation](../drivers/ios-uiautomation.md) | 8.0 to 9.3 | All | All | | Android | [Espresso](../drivers/android-espresso.md) | ?+ | 1.9.0+ | All | | | [UiAutomator2](../drivers/android-uiautomator2.md) | ?+ | 1.6.0+ | All | | | [UiAutomator](../drivers/android-uiautomator.md) | 4.3+ | All | All | | Mac | [Mac](../drivers/mac.md) | ?+ | 1.6.4+ | All | | Windows | [Windows](../drivers/windows.md) | 10+ | 1.6.0+ | All | [//]: # "DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/mobile-command.yml" ### Appium Clients |语言|支持|文档| |--------|-------|-------------| |[Java](https://github.com/appium/java-client/releases/latest)| All | [seleniumhq.github.io](https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/remote/RemoteWebDriver.html#executeScript-java.lang.String-java.lang.Object...-) | |[Python](https://github.com/appium/python-client/releases/latest)| All | [selenium-python.readthedocs.io](http://selenium-python.readthedocs.io/api.html#selenium.webdriver.remote.webdriver.WebDriver.execute_script) | |[Javascript (WebdriverIO)](http://webdriver.io/index.html)| All | | |[Javascript (WD)](https://github.com/admc/wd/releases/latest)| All | [github.com](https://github.com/admc/wd/blob/master/lib/commands.js#L102) | |[Ruby](https://github.com/appium/ruby_lib/releases/latest)| All | [www.rubydoc.info](https://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/Driver:execute_script) | |[PHP](https://github.com/appium/php-client/releases/latest)| All | [github.com](https://github.com/appium/php-client/) | |[C#](https://github.com/appium/appium-dotnet-driver/releases/latest)| All | [github.com](https://github.com/appium/appium-dotnet-driver/) | [//]: # "DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/mobile-command.yml" ## HTTP API 技术 [//]: # "DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/mobile-command.yml" ### Endpoint `POST /session/:session_id/execute` [//]: # "DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/mobile-command.yml" ### URL 参数 |名称|描述| |----|-----------| |session_id|ID of the session to route the command to| [//]: # "DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/mobile-command.yml" ### JSON 参数 |名称|类型|描述| |----|----|-----------| | script | `string` | The mobile command to execute | | args | `array` | The JSON serializable arguments | [//]: # "DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/mobile-command.yml" ### 返回值 指令结果 (`any`) [//]: # "DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/mobile-command.yml" ## 参考 * [W3C Specification](https://www.w3.org/TR/webdriver/#dfn-execute-script) * [JSONWP Specification](https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidexecute)