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

Using 'Displayed' leads to WebDriverException on 4.0.0.2-beta #263

Closed
lanzelot1989 opened this issue Oct 1, 2018 · 9 comments · Fixed by #264
Closed

Using 'Displayed' leads to WebDriverException on 4.0.0.2-beta #263

lanzelot1989 opened this issue Oct 1, 2018 · 9 comments · Fixed by #264
Assignees
Labels

Comments

@lanzelot1989
Copy link
Contributor

lanzelot1989 commented Oct 1, 2018

Description

When using Appium.WebDriver 4.0.0.2-beta the Displayed property throws a WebDriverException.

Environment

  • Appium server version or git revision if you use some shapshot: 1.9.1
  • Desktop OS/version used to run Appium if necessary: Win 10
  • Node.js version: 10.10.0
  • Mobile platform/version under test: Android
  • Real device or emulator/simulator: Emulator, API 26 (8.0)

Details

Using the Displayed property throws the exceptions below with 4.0.0.2-beta, this still worked with 4.0.0.1-beta. The Enabled property works as excepted.

Used package versions:

Appium.WebDriver: 4.0.0.2-beta
Castle.Core: 4.3.1
Newtonsoft.Json: 11.0.2
Selenium.WebDriver: 3.14.0
Selenium.Support: 3.14.0

Code To Reproduce Issue [ Good To Have ]

driver.FindElementByAccessibilityId("myButton").Displayed

Exception stacktraces

'driver.FindElementByAccessibilityId("button").Displayed' threw an exception of type 'OpenQA.Selenium.WebDriverException'
    Data: {System.Collections.ListDictionaryInternal}
    HResult: -2146233088
    HelpLink: null
    InnerException: null
    Message: "Method is not implemented"
    Source: "WebDriver"
    StackTrace: "   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)\r\n   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)\r\n   at OpenQA.Selenium.Appium.AppiumDriver`1.Execute(String driverCommandToExecute, Dictionary`2 parameters)\r\n   at OpenQA.Selenium.Remote.RemoteWebElement.Execute(String commandToExecute, Dictionary`2 parameters)\r\n   at OpenQA.Selenium.Remote.RemoteWebElement.get_Displayed()\r\n   at OpenQA.Selenium.Appium.AppiumWebElement.<get_Displayed>b__10_0()\r\n   at OpenQA.Selenium.Appium.AppiumWebElement.CacheValue(String key, Func`1 getter)\r\n   at OpenQA.Selenium.Appium.AppiumWebElement.get_Displayed()"
    TargetSite: {Void UnpackAndThrowOnError(OpenQA.Selenium.Remote.Response)}

Link to Appium logs

[debug] [W3C] Calling AppiumDriver.execute() with args: ["return (function(){return function(){var k=this;function l(a){return void 0!==a}function m(a){return\"string\"==typeof a}function aa(a,b){a=a.split(\".\");var c=k;a[0]in c||!c.execScript||c.execScript(\"var \"+a[0]);for(var d;a.length&&(d=a.shift());)!a.length&&l(b)?c[d]=b:c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}}\nfunction ba(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\";\nelse if(\"function\"==b&&\"undefined\"==typeof a.call)return\"object\";return b}function ca(a,b,c){return a.call.apply(a.b...
[debug] [W3C] Encountered internal error running command: NotImplementedError: Method is not implemented
[debug] [W3C]     at AndroidUiautomator2Driver.callee$0$0$ (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\appium-android-driver\lib\commands\execute.js:12:9)
[debug] [W3C]     at tryCatch (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
[debug] [W3C]     at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
[debug] [W3C]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
[debug] [W3C]     at invoke (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[debug] [W3C]     at enqueueResult (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:185:17)
[debug] [W3C]     at new Promise (<anonymous>)
[debug] [W3C]     at new F (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\core-js\library\modules\$.export.js:30:36)
[debug] [W3C]     at AsyncIterator.enqueue (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:184:12)
[debug] [W3C]     at AsyncIterator.prototype.(anonymous function) [as next] (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
[debug] [W3C]     at Object.runtime.async (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:209:12)
[debug] [W3C]     at AndroidUiautomator2Driver.callee$0$0 [as execute] (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\appium-android-driver\build\lib\commands\execute.js:20:30)
[debug] [W3C]     at C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\basedriver\driver.js:296:26
[debug] [W3C]     at tryCatcher (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\node_modules\bluebird\js\main\util.js:26:23)
[debug] [W3C]     at Promise._settlePromiseFromHandler (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\node_modules\bluebird\js\main\promise.js:510:31)
[debug] [W3C]     at Promise._settlePromiseAt (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\node_modules\bluebird\js\main\promise.js:584:18)
[debug] [W3C]     at Promise._settlePromiseAtPostResolution (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\node_modules\bluebird\js\main\promise.js:248:10)
[debug] [W3C]     at Async._drainQueue (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\node_modules\bluebird\js\main\async.js:128:12)
[debug] [W3C]     at Async._drainQueues (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\node_modules\bluebird\js\main\async.js:133:10)
[debug] [W3C]     at Immediate.Async.drainQueues (C:\Users\myUser\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\node_modules\bluebird\js\main\async.js:15:14)
[debug] [W3C]     at runCallback (timers.js:694:18)
[debug] [W3C]     at tryOnImmediate (timers.js:665:5)
[debug] [W3C]     at processImmediate (timers.js:647:5)
[HTTP] <-- POST /wd/hub/session/92ea8af1-4a1c-40d1-8645-d58f9e528017/execute/sync 405 26 ms - 3510
[HTTP]
@mykola-mokhnach
Copy link

This happens because the original ,net Selenium lib intercepts some API calls in W3C mode (inlcuding isDisplayed) and replaces them with executeScript block, which is ok for web browsers, but does not make any sense in mobile env. We had to workaround it in java client and it looks like it is necessary to do the same for the .net one

CC @akinsolb

@laolubenson
Copy link
Collaborator

laolubenson commented Oct 1, 2018

@mykola-mokhnach Going to fix this today by applying a JSONWP command for IsElementDisplayed.

@laolubenson laolubenson self-assigned this Oct 1, 2018
@mykola-mokhnach
Copy link

I mean this is not the only endpoint, that might be affected:
appium/java-client#825
appium/java-client#833

@laolubenson
Copy link
Collaborator

@mykola-mokhnach Can I be sure that the same endpoints apply to the .Net version?

@mykola-mokhnach
Copy link

I cannot say for sure. It is just for your information and depends on the actual W3C implementation by the .net client

@laolubenson
Copy link
Collaborator

There aren't any tests for this yet. I'll find out sooner or later. @lanzelot1989 I'll publish a new beta today.

@lanzelot1989
Copy link
Contributor Author

@akinsolb: Thanks for the quick feedback.

Maybe there is a related problem, please tell me if I should enter it separately:
The Driver.FindElementByClassName method seems to try to use a CSS selector internally.

This sound like it is something similar to what @mykola-mokhnach described.

@laolubenson
Copy link
Collaborator

@lanzelot1989 please raise a separate issue for the 'The Driver.FindElementByClassName' problem

@lanzelot1989
Copy link
Contributor Author

@akinsolb as requested, I created appium-dotnet-driver#265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants