Winappdriver: Situation where 2 elements have same properties except the help text

Created on 4 Apr 2018  路  3Comments  路  Source: microsoft/WinAppDriver

I need to select "Print on Both Sides" for long edge and short edge options in MSWord print flow but these 2 options have the same name but their help text is different so I used XPath using this help text which isn't working.

DuplexListComboBox.findElement(By.xpath("//ListItem[@Help = 'Flip pages on long edge']")).click();
DuplexListComboBox.findElement(By.xpath("//ListItem[@Help = 'Flip pages on short edge']")).click();
Also checked "Help Text" in place of "Help". Is this limitation with WinAppDriver?

image

image

Wire protocol log indicates Invalid XPath expression but xpath looks correct.

8-04-04 17:28:56:858 - info: [WinAppDriver] [STDOUT] {"sessionId":"DE7C2389-F6AB-4011-AF5E-2E7888F22940","status":0,"value":{"ELEMENT":"42.10030002.3.333360032.0"}}
2018-04-04 17:28:56:858 - info: [debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"DE7C2389-F6AB-4011-AF5E-2E7888F22940","status":0,"value":{"ELEMENT":"42.10030002.3.333360032.0"}}
2018-04-04 17:28:56:858 - info: [JSONWP Proxy] Replacing sessionId DE7C2389-F6AB-4011-AF5E-2E7888F22940 with 647305a0-2cf7-45e0-9d72-e48bd4d28155
2018-04-04 17:28:56:858 - info: [HTTP] <-- POST /wd/hub/session/647305a0-2cf7-45e0-9d72-e48bd4d28155/element 200 583 ms - 111
2018-04-04 17:28:56:874 - info: [HTTP] --> POST /wd/hub/session/647305a0-2cf7-45e0-9d72-e48bd4d28155/element/42.10030002.3.333360032.0/element {"id":"42.10030002.3.333360032.0","using":"xpath","value":"//ListItem[@Help Text ='Flip pages on long edge']"}
2018-04-04 17:28:56:874 - info: [MJSONWP] Driver proxy active, passing request on via HTTP proxy
2018-04-04 17:28:56:874 - info: [debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/647305a0-2cf7-45e0-9d72-e48bd4d28155/element/42.10030002.3.333360032.0/element] to [POST http://127.0.0.1:4725/wd/hub/session/DE7C2389-F6AB-4011-AF5E-2E7888F22940/element/42.10030002.3.333360032.0/element] with body: {"id":"42.10030002.3.333360032.0","using":"xpath","value":"//ListItem[@Help Text ='Flip pages on long edge']"}
2018-04-04 17:28:56:874 - info: [WinAppDriver] [STDOUT]
2018-04-04 17:28:56:874 - info: [WinAppDriver] [STDOUT]
2018-04-04 17:28:56:874 - info: [WinAppDriver] [STDOUT] ==========================================
2018-04-04 17:28:56:874 - info: [WinAppDriver] [STDOUT] POST /wd/hub/session/DE7C2389-F6AB-4011-AF5E-2E7888F22940/element/42.10030002.3.333360032.0/element HTTP/1.1
2018-04-04 17:28:56:874 - info: [WinAppDriver] [STDOUT] Accept: /
2018-04-04 17:28:56:874 - info: [WinAppDriver] [STDOUT] Connection: keep-alive
2018-04-04 17:28:56:874 - info: [WinAppDriver] [STDOUT] Content-Length: 110
2018-04-04 17:28:56:874 - info: [WinAppDriver] [STDOUT] Content-Type: application/json
2018-04-04 17:28:56:874 - info: [WinAppDriver] [STDOUT] Host: 127.0.0.1:4725
2018-04-04 17:28:56:874 - info: [WinAppDriver] [STDOUT] User-Agent: appium
2018-04-04 17:28:56:874 - info: [WinAppDriver] [STDOUT]
2018-04-04 17:28:56:874 - info: [WinAppDriver] [STDOUT] {"id":"42.10030002.3.333360032.0","using":"xpath","value":"//ListItem[@Help Text ='Flip pages on long edge']"}
2018-04-04 17:28:56:952 - info: [WinAppDriver] [STDOUT] HTTP/1.1 500 Internal Error
2018-04-04 17:28:56:952 - info: [WinAppDriver] [STDOUT] Content-Length: 140
2018-04-04 17:28:56:952 - info: [WinAppDriver] [STDOUT] Content-Type: application/json
2018-04-04 17:28:56:952 - info: [WinAppDriver] [STDOUT]
2018-04-04 17:28:56:952 - info: [WinAppDriver] [STDOUT] {"status":19,"value":{"error":"XPath Lookup Error","message":"Invalid XPath expression: //ListItem[@Help Text ='Flip pages on long edge']"}}
2018-04-04 17:28:56:952 - error: [MJSONWP] Encountered internal error running command: {"w3cStatus":400,"jsonwp":{"status":19,"value":{"error":"XPath Lookup Error","message":"Invalid XPath expression: //ListItem[@Help Text ='Flip pages on long edge']"}}} ProxyRequestError: Could not proxy command to remote server. Original error: 500 - {"status":19,"value":{"error":"XPath Lookup Error","message":"Invalid XPath expression: //ListItem[@Help Text ='Flip pages on long edge']"}}
at JWProxy.proxy$ (C:\Users\veramitAppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\jsonwp-proxy\proxy.js:152:13)
at tryCatch (C:\Users\veramitAppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\veramitAppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\veramitAppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Users\veramitAppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
at

Most helpful comment

Excellent @timotiusmargo it worked.
General feedback, I am having a good time with Windows Automation using WinAppDriver (integrated with Appium). Loved the way scroll is auto handled in many cases so I guess this is Kudos to the WinAppDriver team!!

All 3 comments

could use up and down arrow key to get moving but don't want to take that approach.

Hi @AmitVerma4HP,

It looks like the way you specify Help Text attribute is the reason why you get the error. Would you try to replace help Text with HelpText in your XPath query? E.g.
//ListItem[@HelpText ='Flip pages on long edge']

Excellent @timotiusmargo it worked.
General feedback, I am having a good time with Windows Automation using WinAppDriver (integrated with Appium). Loved the way scroll is auto handled in many cases so I guess this is Kudos to the WinAppDriver team!!

Was this page helpful?
0 / 5 - 0 ratings