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

Internal error running command: NotImplementedError: Method is not implemented #957

Closed
azavor opened this issue Sep 9, 2024 · 4 comments

Comments

@azavor
Copy link

azavor commented Sep 9, 2024

Exactly the same issue was reported on Appium support forum almost a year ago without any responses: https://discuss.appium.io/t/unknownmethoderror-method-is-not-implemented-for-isdisplayed/40659

Description

In the native context isDisplayed function is not working:

[623facea][AndroidUiautomator2Driver@383c] Calling AppiumDriver.findElements() with args: ["xpath","//*[@text='Settings']","623facea-0788-4b68-a74c-a6d6181ccde1"]

[623facea][AndroidUiautomator2Driver@383c] Valid locator strategies for this request: xpath, id, class name, accessibility id, css selector, -android uiautomator

[623facea][AndroidUiautomator2Driver@383c] Waiting up to 0 ms for condition

[623facea][AndroidUiautomator2Driver@383c] Matched '/elements' to command name 'findElements'

[623facea][AndroidUiautomator2Driver@383c] Proxying [POST /elements] to [POST http://127.0.0.1:62407/session/3e47da67-3115-477a-b579-d67929d3f47e/elements] with body: {"strategy":"xpath","selector":"//*[@text='Settings']","context":"","multiple":true}

[623facea][AndroidUiautomator2Driver@383c] Got response with status 200: {"sessionId":"3e47da67-3115-477a-b579-d67929d3f47e","value":[{"ELEMENT":"00000000-0000-003b-ffff-ffff00000007","element-6066-11e4-a52e-4f735466cecf":"00000000-0000-003b-ffff-ffff00000007"}]}

[623facea][AndroidUiautomator2Driver@383c] Responding to client with driver.findElements() result: [{"element-6066-11e4-a52e-4f735466cecf":"00000000-0000-003b-ffff-ffff00000007","ELEMENT":"00000000-0000-003b-ffff-ffff00000007"}]

[623facea][HTTP] <-- POST /wd/hub/session/623facea-0788-4b68-a74c-a6d6181ccde1/elements 200 237 ms - 139 

[623facea][HTTP] --> POST /wd/hub/session/623facea-0788-4b68-a74c-a6d6181ccde1/execute/sync {"script":"/* isDisplayed */return (function(){return (function(){var g=this||self;\nfunction aa(a){var b=typeof a;if(\"object\"==b)if(a){if(a instanceof Array)return\"array\";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if(\"[object Window]\"==c)return\"object\";if(\"[object Array]\"==c||\"number\"==typeof a.length&&\"undefined\"!=typeof a.splice&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"splice\"))return\"array\";if(\"[object Function]\"==c||\"undefined\"!=typeof a.call&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"call\"))return\"function\"}else return\"null\";else if(\"function\"==\nb&&\"undefined\"==typeof a.call)return\"object\";return b}function ca(a,b){function c(){}c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};var da=Array.prototype.indexOf?function(a,b){return Array.prototype.indexOf.call(a,b,void 0)}:function(a,b){if(\"string\"===typeof a)return\"string\"!==typeof b||1!=b.length?-1:a.indexO...

[623facea][AndroidUiautomator2Driver@383c] Calling AppiumDriver.execute() with args: ["/* isDisplayed */return (function(){return (function(){var g=this||self;\nfunction aa(a){var b=typeof a;if(\"object\"==b)if(a){if(a instanceof Array)return\"array\";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if(\"[object Window]\"==c)return\"object\";if(\"[object Array]\"==c||\"number\"==typeof a.length&&\"undefined\"!=typeof a.splice&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"splice\"))return\"array\";if(\"[object Function]\"==c||\"undefined\"!=typeof a.call&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"call\"))return\"function\"}else return\"null\";else if(\"function\"==\nb&&\"undefined\"==typeof a.call)return\"object\";return b}function ca(a,b){function c(){}c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};var da=Array.prototype.indexOf?function(a,b){return Array.prototype.indexOf.call(a,b,void 0)}:function(a,b){if(\"string\"===typeof a)return\"string\"!==typeof b||1!=b.length?-1:a.indexOf(b,0);fo...

[623facea][AndroidUiautomator2Driver@383c] Encountered internal error running command: NotImplementedError: Method is not implemented
    at AndroidUiautomator2Driver.execute (/Users/sources/phoenix/android/appium/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/execute.js:121:11)
    at runCommandPromise (/Users/sources/phoenix/android/appium/node_modules/appium-uiautomator2-driver/node_modules/@appium/base-driver/lib/basedriver/driver.ts:115:20)
    at /Users/sources/phoenix/android/appium/node_modules/appium-uiautomator2-driver/node_modules/async-lock/lib/index.js:171:12
    at AsyncLock._promiseTry (/Users/sources/phoenix/android/appium/node_modules/appium-uiautomator2-driver/node_modules/async-lock/lib/index.js:306:31)
    at exec (/Users/sources/phoenix/android/appium/node_modules/appium-uiautomator2-driver/node_modules/async-lock/lib/index.js:170:9)
    at AsyncLock.acquire (/Users/sources/phoenix/android/appium/node_modules/appium-uiautomator2-driver/node_modules/async-lock/lib/index.js:189:3)
    at AndroidUiautomator2Driver.executeCommand (/Users/sources/phoenix/android/appium/node_modules/appium-uiautomator2-driver/node_modules/@appium/base-driver/lib/basedriver/driver.ts:148:39)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at defaultBehavior (/Users/sources/phoenix/android/appium/node_modules/appium/lib/appium.js:1123:14)
    at AppiumDriver.executeWrappedCommand (/Users/sources/phoenix/android/appium/node_modules/appium/lib/appium.js:1229:16)
    at AppiumDriver.executeCommand (/Users/sources/phoenix/android/appium/node_modules/appium/lib/appium.js:1135:17)
    at asyncHandler (/Users/sources/phoenix/android/appium/node_modules/@appium/base-driver/lib/protocol/protocol.js:387:19)

[623facea][HTTP] <-- POST /wd/hub/session/623facea-0788-4b68-a74c-a6d6181ccde1/execute/sync 405 3 ms - 2017

Environment

Operating system: MacOS Sonoma 14.6.1
Appium server version: 2.11.3
Appium driver(s) and their version(s): AndroidUiautomator2Driver 3.7.8
Node.js version: 20.13.1
npm version: 10.5.2
Last component(s) version which did not exhibit the problem: appium 1.22.3
Platform and version under test: Cucumber 8.5.3 selenium-webdriver 4.23.0
Real device or emulator/simulator: Android 12 device

@jlipps
Copy link
Member

jlipps commented Sep 9, 2024

execute script is not implemented for the Android driver, since you cannot run JavaScript on Android native apps. Use an Appium client to get access to the native isDisplayed command.

@jlipps jlipps closed this as completed Sep 9, 2024
@azavor
Copy link
Author

azavor commented Sep 9, 2024

@jlipps Can you explain what do you mean by 'Appium client' please? I use configuration that worked fine for pre W3C Appium/Selenium. And it works now for latest versions Appium/Selenium with exception of isDisplayed and getAttribute functions in the native context.

@jlipps
Copy link
Member

jlipps commented Sep 9, 2024

You can't use the selenium-webdriver client. You should use an Appium client instead if you want to take advantage of commands that Selenium doesn't know about as protocol commands (like isDisplayed, which has been "demoted" in Selenium from its own API call to simply sending a bunch of JS, as explained thoroughly in the other issue you opened.)

@azavor
Copy link
Author

azavor commented Sep 9, 2024

OK, thanks for your help

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

No branches or pull requests

2 participants