You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
findelement byname does not work with appium 1.9.1 #1050
On a native page, my test tries to find an element via byname: command passed into driver is: findElement(By.name: EULA.agree), while I saw the command executed to the appium server is:
Hmm, the change that you mentioned is for page object tools. While in my test, I use By.Name directly instead of @findby annotation. I am kind lost. @saikrishna321
Did more try. Instead of using by.name, switch to use the xpath to find an element on a native page. Compared with java_client 6.1.0 + appium 1.8.1 and java_client 6.1.0 + appium 1.9.1, the test app, ios version are same. Successfully fin the element for java_client 6.1.0 + appium 1.8.1 , while fail to find it for java_client 6.1.0 + appium 1.9.1. One thing cannot understand is, for java_client 6.1.0 + appium 1.9.1, after finding the element, call element/sync instead of element/displayed? @saikrishna321
Here is detail logs: using By.xpath("//XCUIElementTypeButton”) to find an element on a native page.
With java_client 6.1.0 + appium 1.9.1, fail to find it. Here is the appium logs:
2018-10-26 00:07:49:765 - [HTTP] --> GET /wd/hub/session/3ee94005-3eee-44f8-93cd-e66d78f6cf90/context
2018-10-26 00:07:49:765 - [HTTP] {}
2018-10-26 00:07:49:767 - [debug] [W3C] Calling AppiumDriver.getCurrentContext() with args: ["3ee94005-3eee-44f8-93cd-e66d78f6cf90"]
2018-10-26 00:07:49:770 - [debug] [XCUITest] Executing command 'getCurrentContext'
2018-10-26 00:07:49:775 - [debug] [W3C] Responding to client with driver.getCurrentContext() result: "NATIVE_APP"
2018-10-26 00:07:49:775 - [HTTP] <-- GET /wd/hub/session/3ee94005-3eee-44f8-93cd-e66d78f6cf90/context 200 10 ms - 22
2018-10-26 00:07:49:776 - [HTTP]
2018-10-26 00:07:49:781 - [HTTP] --> POST /wd/hub/session/3ee94005-3eee-44f8-93cd-e66d78f6cf90/elements
2018-10-26 00:07:49:781 - [HTTP] {"value":"//XCUIElementTypeButton","using":"xpath"}
2018-10-26 00:07:49:781 - [debug] [W3C] Calling AppiumDriver.findElements() with args: ["xpath","//XCUIElementTypeButton","3ee94005-3eee-44f8-93cd-e66d78f6cf90"]
2018-10-26 00:07:49:782 - [debug] [XCUITest] Executing command 'findElements'
2018-10-26 00:07:49:783 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
2018-10-26 00:07:49:785 - [debug] [BaseDriver] Waiting up to 5000 ms for condition
2018-10-26 00:07:49:786 - [debug] [JSONWP Proxy] Matched '/elements' to command name 'findElements'
2018-10-26 00:07:49:786 - [debug] [JSONWP Proxy] Proxying [POST /elements] to [POST http://localhost:8100/session/74253321-22DD-4A1E-AE54-5578A7C49E28/elements] with body: {"using":"xpath","value":"//XCUIElementTypeButton"}
2018-10-26 00:07:53:234 - [debug] [JSONWP Proxy] Got response with status 200: {"value":[{"ELEMENT":"23000000-0000-0000-D32E-000000000000"}],"sessionId":"74253321-22DD-4A1E-AE54-5578A7C49E28","status":0}
2018-10-26 00:07:53:235 - [debug] [W3C] Responding to client with driver.findElements() result: [{"element-6066-11e4-a52e-4f735466cecf":"23000000-0000-0000-D32E-000000000000"}]
2018-10-26 00:07:53:236 - [HTTP] <-- POST /wd/hub/session/3ee94005-3eee-44f8-93cd-e66d78f6cf90/elements 200 3455 ms - 90
2018-10-26 00:07:53:236 - [HTTP]
2018-10-26 00:07:53:254 - [HTTP] --> POST /wd/hub/session/3ee94005-3eee-44f8-93cd-e66d78f6cf90/execute/sync
2018-10-26 00:07:53:255 - [HTTP] {"script":"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(
2018-10-26 00:07:53:256 - [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...
2018-10-26 00:07:53:257 - [debug] [XCUITest] Executing command 'execute'
2018-10-26 00:07:53:262 - [debug] [W3C] Encountered internal error running command: NotImplementedError: Method is not implemented
While for java_client 6.1.0 + appium 1.8.1, successfully find the element:
2018-10-26 00:13:47:460 - [HTTP] --> GET /wd/hub/session/ae8b670d-e4d4-4652-8982-e8ead579b404/context
2018-10-26 00:13:47:460 - [HTTP] {}
2018-10-26 00:13:47:462 - [debug] [W3C] Calling AppiumDriver.getCurrentContext() with args: ["ae8b670d-e4d4-4652-8982-e8ead579b404"]
2018-10-26 00:13:47:462 - [debug] [XCUITest] Executing command 'getCurrentContext'
2018-10-26 00:13:47:464 - [debug] [MJSONWP] Responding to client with driver.getCurrentContext() result: "NATIVE_APP"
2018-10-26 00:13:47:465 - [HTTP] <-- GET /wd/hub/session/ae8b670d-e4d4-4652-8982-e8ead579b404/context 200 5 ms - 84
2018-10-26 00:13:47:465 - [HTTP]
2018-10-26 00:13:47:470 - [HTTP] --> POST /wd/hub/session/ae8b670d-e4d4-4652-8982-e8ead579b404/elements
2018-10-26 00:13:47:470 - [HTTP] {"using":"xpath","value":"//XCUIElementTypeButton"}
2018-10-26 00:13:47:471 - [debug] [W3C] Calling AppiumDriver.findElements() with args: ["xpath","//XCUIElementTypeButton","ae8b670d-e4d4-4652-8982-e8ead579b404"]
2018-10-26 00:13:47:471 - [debug] [XCUITest] Executing command 'findElements'
2018-10-26 00:13:47:472 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
2018-10-26 00:13:47:474 - [debug] [BaseDriver] Waiting up to 0 ms for condition
2018-10-26 00:13:47:475 - [debug] [JSONWP Proxy] Proxying [POST /elements] to [POST http://localhost:8100/session/B1F83BAC-99A8-4A71-B0D8-0A237EF859A8/elements] with body: {"using":"xpath","value":"//XCUIElementTypeButton"}
2018-10-26 00:13:51:056 - [debug] [JSONWP Proxy] Got response with status 200: {"value":[{"ELEMENT":"23000000-0000-0000-C431-000000000000"}],"sessionId":"B1F83BAC-99A8-4A71-B0D8-0A237EF859A8","status":0}
2018-10-26 00:13:51:057 - [debug] [MJSONWP] Responding to client with driver.findElements() result: [{"ELEMENT":"23000000-0000-0000-C431-000000000000"}]
2018-10-26 00:13:51:057 - [HTTP] <-- POST /wd/hub/session/ae8b670d-e4d4-4652-8982-e8ead579b404/elements 200 3587 ms - 124
2018-10-26 00:13:51:057 - [HTTP]
2018-10-26 00:13:51:069 - [HTTP] --> GET /wd/hub/session/ae8b670d-e4d4-4652-8982-e8ead579b404/element/23000000-0000-0000-C431-000000000000/displayed
after configure via using capability: MobileCapabilityType.FORCE_MJSONWP to true to still use OSS instead of the default W3C, this issue has been gone for me. @ndeztea
Hi @mykola-mokhnach sorry, i am still newbie please be patient on me. Can you please explain more? coz i really don't understand. I am still learning, btw this runs on browser but when i have changed the setup to mobile chrome. I am facing this error. I've been searching and trying all the stuff that i've searched on the internet but still no luck.
@mykola-mokhnach sorry i cannot understand why i am facing this error. The answer that it only supports double quotes as string separators. I've tried to comment out the xpath / button if it will still continue to send keys. But i still face the error even without the xpath
@shibupanda oh sir it works! thank you so much. This is my first time participating here in github i am really desperate and thanks to you, you have solved my problem. Sir may i know why id doesn't work earlier? and have to change to xpath? is it good to ask following question here?
Activity
helenren commentedon Oct 25, 2018
@jlipps do you aware any issue related to? thanks
saikrishna321 commentedon Oct 25, 2018
name was deprecated in favor of accessiblity id
helenren commentedon Oct 25, 2018
so, for ios, we should use by.accessibilityid or by.id? where we can find the info on change for search property support ? @saikrishna321
saikrishna321 commentedon Oct 25, 2018
@helenren this was very old change which went through, may be in version 5.0.0 BETAX not sure though.. But for sure this change was done long back.
helenren commentedon Oct 25, 2018
Hmm, the change that you mentioned is for page object tools. While in my test, I use By.Name directly instead of @findby annotation. I am kind lost. @saikrishna321
saikrishna321 commentedon Oct 25, 2018
#313
helenren commentedon Oct 26, 2018
Did more try. Instead of using by.name, switch to use the xpath to find an element on a native page. Compared with java_client 6.1.0 + appium 1.8.1 and java_client 6.1.0 + appium 1.9.1, the test app, ios version are same. Successfully fin the element for java_client 6.1.0 + appium 1.8.1 , while fail to find it for java_client 6.1.0 + appium 1.9.1. One thing cannot understand is, for java_client 6.1.0 + appium 1.9.1, after finding the element, call element/sync instead of element/displayed? @saikrishna321
Here is detail logs:
using By.xpath("//XCUIElementTypeButton”) to find an element on a native page.
With java_client 6.1.0 + appium 1.9.1, fail to find it. Here is the appium logs:
2018-10-26 00:07:49:765 - [HTTP] --> GET /wd/hub/session/3ee94005-3eee-44f8-93cd-e66d78f6cf90/context
2018-10-26 00:07:49:765 - [HTTP] {}
2018-10-26 00:07:49:767 - [debug] [W3C] Calling AppiumDriver.getCurrentContext() with args: ["3ee94005-3eee-44f8-93cd-e66d78f6cf90"]
2018-10-26 00:07:49:770 - [debug] [XCUITest] Executing command 'getCurrentContext'
2018-10-26 00:07:49:775 - [debug] [W3C] Responding to client with driver.getCurrentContext() result: "NATIVE_APP"
2018-10-26 00:07:49:775 - [HTTP] <-- GET /wd/hub/session/3ee94005-3eee-44f8-93cd-e66d78f6cf90/context 200 10 ms - 22
2018-10-26 00:07:49:776 - [HTTP]
2018-10-26 00:07:49:781 - [HTTP] --> POST /wd/hub/session/3ee94005-3eee-44f8-93cd-e66d78f6cf90/elements
2018-10-26 00:07:49:781 - [HTTP] {"value":"//XCUIElementTypeButton","using":"xpath"}
2018-10-26 00:07:49:781 - [debug] [W3C] Calling AppiumDriver.findElements() with args: ["xpath","//XCUIElementTypeButton","3ee94005-3eee-44f8-93cd-e66d78f6cf90"]
2018-10-26 00:07:49:782 - [debug] [XCUITest] Executing command 'findElements'
2018-10-26 00:07:49:783 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
2018-10-26 00:07:49:785 - [debug] [BaseDriver] Waiting up to 5000 ms for condition
2018-10-26 00:07:49:786 - [debug] [JSONWP Proxy] Matched '/elements' to command name 'findElements'
2018-10-26 00:07:49:786 - [debug] [JSONWP Proxy] Proxying [POST /elements] to [POST http://localhost:8100/session/74253321-22DD-4A1E-AE54-5578A7C49E28/elements] with body: {"using":"xpath","value":"//XCUIElementTypeButton"}
2018-10-26 00:07:53:234 - [debug] [JSONWP Proxy] Got response with status 200: {"value":[{"ELEMENT":"23000000-0000-0000-D32E-000000000000"}],"sessionId":"74253321-22DD-4A1E-AE54-5578A7C49E28","status":0}
2018-10-26 00:07:53:235 - [debug] [W3C] Responding to client with driver.findElements() result: [{"element-6066-11e4-a52e-4f735466cecf":"23000000-0000-0000-D32E-000000000000"}]
2018-10-26 00:07:53:236 - [HTTP] <-- POST /wd/hub/session/3ee94005-3eee-44f8-93cd-e66d78f6cf90/elements 200 3455 ms - 90
2018-10-26 00:07:53:236 - [HTTP]
2018-10-26 00:07:53:254 - [HTTP] --> POST /wd/hub/session/3ee94005-3eee-44f8-93cd-e66d78f6cf90/execute/sync
2018-10-26 00:07:53:255 - [HTTP] {"script":"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(
2018-10-26 00:07:53:256 - [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...
2018-10-26 00:07:53:257 - [debug] [XCUITest] Executing command 'execute'
2018-10-26 00:07:53:262 - [debug] [W3C] Encountered internal error running command: NotImplementedError: Method is not implemented
While for java_client 6.1.0 + appium 1.8.1, successfully find the element:
2018-10-26 00:13:47:460 - [HTTP] --> GET /wd/hub/session/ae8b670d-e4d4-4652-8982-e8ead579b404/context
2018-10-26 00:13:47:460 - [HTTP] {}
2018-10-26 00:13:47:462 - [debug] [W3C] Calling AppiumDriver.getCurrentContext() with args: ["ae8b670d-e4d4-4652-8982-e8ead579b404"]
2018-10-26 00:13:47:462 - [debug] [XCUITest] Executing command 'getCurrentContext'
2018-10-26 00:13:47:464 - [debug] [MJSONWP] Responding to client with driver.getCurrentContext() result: "NATIVE_APP"
2018-10-26 00:13:47:465 - [HTTP] <-- GET /wd/hub/session/ae8b670d-e4d4-4652-8982-e8ead579b404/context 200 5 ms - 84
2018-10-26 00:13:47:465 - [HTTP]
2018-10-26 00:13:47:470 - [HTTP] --> POST /wd/hub/session/ae8b670d-e4d4-4652-8982-e8ead579b404/elements
2018-10-26 00:13:47:470 - [HTTP] {"using":"xpath","value":"//XCUIElementTypeButton"}
2018-10-26 00:13:47:471 - [debug] [W3C] Calling AppiumDriver.findElements() with args: ["xpath","//XCUIElementTypeButton","ae8b670d-e4d4-4652-8982-e8ead579b404"]
2018-10-26 00:13:47:471 - [debug] [XCUITest] Executing command 'findElements'
2018-10-26 00:13:47:472 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
2018-10-26 00:13:47:474 - [debug] [BaseDriver] Waiting up to 0 ms for condition
2018-10-26 00:13:47:475 - [debug] [JSONWP Proxy] Proxying [POST /elements] to [POST http://localhost:8100/session/B1F83BAC-99A8-4A71-B0D8-0A237EF859A8/elements] with body: {"using":"xpath","value":"//XCUIElementTypeButton"}
2018-10-26 00:13:51:056 - [debug] [JSONWP Proxy] Got response with status 200: {"value":[{"ELEMENT":"23000000-0000-0000-C431-000000000000"}],"sessionId":"B1F83BAC-99A8-4A71-B0D8-0A237EF859A8","status":0}
2018-10-26 00:13:51:057 - [debug] [MJSONWP] Responding to client with driver.findElements() result: [{"ELEMENT":"23000000-0000-0000-C431-000000000000"}]
2018-10-26 00:13:51:057 - [HTTP] <-- POST /wd/hub/session/ae8b670d-e4d4-4652-8982-e8ead579b404/elements 200 3587 ms - 124
2018-10-26 00:13:51:057 - [HTTP]
2018-10-26 00:13:51:069 - [HTTP] --> GET /wd/hub/session/ae8b670d-e4d4-4652-8982-e8ead579b404/element/23000000-0000-0000-C431-000000000000/displayed
ndeztea commentedon Nov 26, 2018
I have the similiar issue on this like this : NotImplementedError: Method is not implemented
anyone have the simliar issue as well ?
helenren commentedon Nov 26, 2018
after configure via using capability: MobileCapabilityType.FORCE_MJSONWP to true to still use OSS instead of the default W3C, this issue has been gone for me. @ndeztea
michaeljohndamo1 commentedon Jun 4, 2020
What could be wrong?
mykola-mokhnach commentedon Jun 4, 2020
@michaeljohndamo1 The xpath locator is invalid. It only supports double quotes as string separators.
michaeljohndamo1 commentedon Jun 4, 2020
Hi @mykola-mokhnach sorry, i am still newbie please be patient on me. Can you please explain more? coz i really don't understand. I am still learning, btw this runs on browser but when i have changed the setup to mobile chrome. I am facing this error. I've been searching and trying all the stuff that i've searched on the internet but still no luck.
mykola-mokhnach commentedon Jun 4, 2020
What exactly is not understandable?
michaeljohndamo1 commentedon Jun 4, 2020
@mykola-mokhnach sorry i cannot understand why i am facing this error. The answer that it only supports double quotes as string separators. I've tried to comment out the xpath / button if it will still continue to send keys. But i still face the error even without the xpath
shibupanda commentedon Jun 4, 2020
Hi @michaeljohndamo1 could you please go with xpath instead of id. Let's have a try.
something like //*[@id='_username'].
michaeljohndamo1 commentedon Jun 4, 2020
Okay sir will try now, thank you :)
michaeljohndamo1 commentedon Jun 4, 2020
hi sir, the error has been changed. But it still cant find the xpath
shibupanda commentedon Jun 4, 2020
@michaeljohndamo1 I can see the id is "username" but in code you have written "_username" please change it.
michaeljohndamo1 commentedon Jun 4, 2020
@shibupanda oh sir it works! thank you so much. This is my first time participating here in github i am really desperate and thanks to you, you have solved my problem. Sir may i know why id doesn't work earlier? and have to change to xpath? is it good to ask following question here?