Skip to content

Commit

Permalink
feat: Get clipboard content via ADB if necessary on Android 10 (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Nov 18, 2019
1 parent 725c13e commit 4f0b90c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions lib/commands/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ commands.getPageSource = async function () {
return await this.uiautomator2.jwproxy.command('/source', 'GET', {});
};

commands.getClipboard = async function () {
return (await this.adb.getApiLevel() < 29)
? (await this.uiautomator2.jwproxy.command('/appium/device/get_clipboard', 'POST', {}))
: (await this.adb.getClipboard());
};

// Need to override this for correct unicode support
commands.doSendKeys = async function (params) {
await this.uiautomator2.jwproxy.command('/keys', 'POST', params);
Expand Down
2 changes: 1 addition & 1 deletion lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const NO_PROXY = [
['POST', new RegExp('^/session/[^/]+/appium/[^/]+/start_activity')],
['POST', new RegExp('^/session/[^/]+/appium/app/[^/]+')],
['POST', new RegExp('^/session/[^/]+/appium/compare_images')],
['POST', new RegExp('^/session/[^/]+/appium/device/(?!set_clipboard|get_clipboard)[^/]+')],
['POST', new RegExp('^/session/[^/]+/appium/device/(?!set_clipboard)[^/]+')],
['POST', new RegExp('^/session/[^/]+/appium/element/[^/]+/replace_value')],
['POST', new RegExp('^/session/[^/]+/appium/element/[^/]+/value')],
['POST', new RegExp('^/session/[^/]+/appium/getPerformanceData')],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
],
"dependencies": {
"@babel/runtime": "^7.0.0",
"appium-adb": "^7.4.0",
"appium-adb": "^7.15.1",
"appium-android-driver": "^4.19.1",
"appium-base-driver": "^4.0.0",
"appium-support": "^2.33.0",
Expand Down

0 comments on commit 4f0b90c

Please sign in to comment.