Error when trying to select element from drop down list in real android device


#1

I receive error in Appium log when trying to select an element from drop down list in real android device in chrome browser.

code:
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(“platformName”, “Android”);
cap.setCapability(“deviceName”, “blabla”);
cap.setCapability(“browserName”, “Chrome”);
cap.setCapability(“chromedriverExecutable”, “C:/Program Files/ilya/chromedriver.exe”);
driver = new AndroidDriver(new URL(“http://0.0.0.0:4723/wd/hub”), cap);
driver.get(url);
WebElement element=driver.findElement(By.cssSelector(“bla”));
new Select(element).selectByIndex(1);

appium log:
[W3C] Driver proxy active, passing request on via HTTP proxy
[JSONWP Proxy] Matched ‘/wd/hub/session/30b6ac05-c950-4c39-b6e1-7646755aa4d7/execute/sync’ to command name ‘execute’
[Protocol Converter] Rewrote the original URL ‘/wd/hub/session/30b6ac05-c950-4c39-b6e1-7646755aa4d7/execute/sync’ to ‘/wd/hub/session/30b6ac05-c950-4c39-b6e1-7646755aa4d7/execute’ for MJSONWP protocol
[JSONWP Proxy] Proxying [POST /wd/hub/session/30b6ac05-c950-4c39-b6e1-7646755aa4d7/execute] to [POST http://127.0.0.1:8001/wd/hub/session/85cbb52fcaac6f555c6385f2f6564944/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”:“85cbb52fcaac6f555c6385f2f6564944”,“status”:13,“value”:{“message”:“unknown error: a.getAttributeNode is not a function\n (Session info: chrome=70.0.3538.80)\n (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 6.1.7601 SP1 x86_64)”}}
[W3C] Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: The request to /wd/hub/session/30b6ac05-c950-4c39-b6e1-7646755aa4d7/execute has failed
[W3C] at JWProxy.proxy$ (C:\Users\ilya\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\jsonwp-proxy\proxy.js:182:13)
[W3C] at tryCatch (C:\Users\ilya\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
[W3C] at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\ilya\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
[W3C] at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\ilya\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
[W3C] at GeneratorFunctionPrototype.invoke (C:\Users\ilya\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[W3C] at run (C:\Users\ilya\AppData\Local\Programs\Appium\resources\app\webpack:~\babel-polyfill~\core-js\modules\es6.promise.js:75:1)
[W3C] at C:\Users\ilya\AppData\Local\Programs\Appium\resources\app\webpack:~\babel-polyfill~\core-js\modules\es6.promise.js:92:1
[W3C] at flush (C:\Users\ilya\AppData\Local\Programs\Appium\resources\app\webpack:~\babel-polyfill~\core-js\modules_microtask.js:18:1)
[W3C] at process._tickCallback (internal/process/next_tick.js:61:11)
[MJSONWP] Matched JSONWP error code 13 to UnknownError
[HTTP] <-- POST /wd/hub/session/30b6ac05-c950-4c39-b6e1-7646755aa4d7/execute/sync 500 81 ms - 2559

Any idea why it happens?


#2

HI @ilya7791 -
I’m trying to retrieve attribute value by using getAttribute.
String ActualValue = driver.findElement(By.xpath("//div[@data-componentname=‘globalHeader’]")).getAttribute(“data-componentname”);
Assert.assertEquals(“data-componentname”,ActualValue,“Message”);

When i run script on laptop - Running fine
When i run same script on google phone - Getting below error.

Exception in thread “main” org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: unknown error: a.getAttributeNode is not a function
(Session info: chrome=70.0.3538.110)

Please help me.