dotnet-client: IWebElement GetAttribute() method doesn't work
Description
C# codes, GetAttribute() method doesn’t work and it gives an error. Please describe the issue. It may be a bug description. So then please briefly descride steps which you were trying to perform and what happened instead. If there is the feature you want to see added to Appium .NET client so please describe necessity of this feature and the way that it should work.
Environment
- .NET client build version or git revision if you use some shapshot:
- Appium server version or git revision if you use some shapshot: Appium Desktop v1.7.1
- Desktop OS/version used to run Appium if necessary: Windows 10 Enterprise
- Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: Node.js v8.12.0
- Mobile platform/version under test: Android 8.0
- Real device or emulator/simulator: Real Device Sony Xperia XZ1
- IDE: VisualStudio 2017 Enterprise and C#
- Appium WebDriver 4.0.0.3-beta
- Selenium.WebDriver 3.14.0
Details
GetAttribute() method doesn’t work (Android Mobile Web Testing). I have tried for different attributes but it gives the same error. Please provide more details, if necessary.
Code To Reproduce Issue [ Good To Have ]
IWebElement info = driver.FindElement(By.CssSelector(“div[class=‘pnr-status’] span”)); string abc=info.GetAttribute(“text”);
Please remember that, with sample code; it’s easier to reproduce bug and much faster to fix it. You can git clone https://github.com/appium/sample-code or https://github.com/appium/sample-code/tree/master/sample-code/apps and reproduce an issue using C# and sample apps. Also you can create a gist with pasted C# code sample or put it here using markdown. About markdown please read Mastering markdown and Writing on GitHub
Ecxeption stacktraces
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Appium.AppiumDriver
1.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Remote.RemoteWebElement.Execute(String commandToExecute, Dictionary
2 parameters)
at OpenQA.Selenium.Remote.RemoteWebElement.GetAttribute(String attributeName)
at OpenQA.Selenium.Appium.AppiumWebElement.<>c__DisplayClass21_0.<GetAttribute>b__0()
at OpenQA.Selenium.Appium.AppiumWebElement.CacheValue(String key, Func`1 getter)
at OpenQA.Selenium.Appium.AppiumWebElement.GetAttribute(String attributeName)
An unknown server-side error occurred while processing the command. Original error: unknown error: a.getAttributeNode is not a function (Session info: chrome=69.0.3497.100) (Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.15063 x86_64)
Please create a gist with pasted stacktrace of exception thrown by .NET.
Link to Appium logs
[JSONWP Proxy] Proxying [POST /wd/hub/session/dc4bfbbc-865d-4c5e-bb46-7fca085d37d2/execute] to [POST http://127.0.0.1:8002/wd/hub/session/f1a97960d66bdfa8163b650ac4910d3e/execute] with body: {“script”:"return (function(){return function(){var d=this;function f(a){return"string"==typeof a};function h(a,b){this.code=a;this.a=l[a]||m;this.message=b||"";a=this.a.replace(/((?:^|\s+)[a-z])/g,function(a){return a.toUpperCase().replace(/^[\s\xa0]+/g,"")});b=a.length-5;if(0>b||a.indexOf("Error",b)!=b)a+="Error";this.name=a;a=Error(this.message);a.name=this.name;this.stack=a.stack||""}\n(function(){var a=Error;function b(){}b.prototype=a.prototype;h.b=a.prototype;h.prototype=new b;h.prototype.constructor=h;h.a=function(b,c,g){for(var e=Array(arguments.length-2),k=2;k [JSONWP Proxy] Got response with status 200: {“sessionId”:“f1a97960d66bdfa8163b650ac4910d3e”,“status”:13,“value”:{“message”:“unknown error: a.getAttributeNode is not a function\n (Session info: chrome=69.0.3497.100)\n (Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.15063 x86_64)”}}
Please create a gist which is a paste of your full Appium logs, and link them here. Do not paste your full Appium logs here, as it will make this issue very long and hard to read! If you are reporting a bug, always include Appium logs as linked gists! It helps to define the problem correctly and clearly.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 30 (5 by maintainers)
@KazuCocoa, I WS using RemoteWebDriver instead of AndroidDriver. Working now after changing to Android Driver. Thanks.