Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Get clipboard content via ADB if necessary on Android 10 #348

Merged
merged 4 commits into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Member

Choose a reason for hiding this comment

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

I noticed https://github.com/appium/appium-adb/pull/473/files#r347388767 was needed since the setting app already returned data as base64 encoded string.

After the change, this logic worked on android 10 👍

? (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