microsoft / WinAppDriver

Windows Application Driver
MIT License
3.66k stars 1.4k forks source link

WinAppDriver on remote is not working without launched inspect.exe #441

Open nsavastejevs opened 6 years ago

nsavastejevs commented 6 years ago

Greetings,

I have following problem. When I'm running WinAppDriver on remote, it throws me error at the beginning of test:

==========================================
GET /session/37F79B11-58A1-43BA-8E6F-4A472A79E686 HTTP/1.1
Accept-Encoding: gzip
Cache-Control: no-cache
Connection: Keep-Alive
Host: 172.26.213.21:4723
User-Agent: selenium/3.12.0 (java windows)

HTTP/1.1 200 OK
Content-Length: 78
Content-Type: application/json

{"status":0,"value":{"appTopLevelWindow":"0x180310","platformName":"Windows"}}

==========================================
POST /session/37F79B11-58A1-43BA-8E6F-4A472A79E686/element HTTP/1.1
Accept-Encoding: gzip
Connection: Keep-Alive
Content-Length: 80
Content-Type: application/json; charset=utf-8
Host: 172.26.213.21:4723
User-Agent: selenium/3.12.0 (java windows)

{"using":"xpath","value":".//*[@LocalizedControlType='edit' and @Name='Email']"}
HTTP/1.1 404 Not Found
Content-Length: 139
Content-Type: application/json

{"status":7,"value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters."}}

Although, if I launch Inspect.exe on remote machine together with WinAppDriver.exe - it finds elements perfectly fine:

==========================================
GET /session/EE9FFAA4-A780-42EF-AA70-39E2E1D8DD4F HTTP/1.1
Accept-Encoding: gzip
Cache-Control: no-cache
Connection: Keep-Alive
Host: 172.26.213.21:4723
User-Agent: selenium/3.12.0 (java windows)

HTTP/1.1 200 OK
Content-Length: 78
Content-Type: application/json

{"status":0,"value":{"appTopLevelWindow":"0x40034C","platformName":"Windows"}}

==========================================
POST /session/EE9FFAA4-A780-42EF-AA70-39E2E1D8DD4F/element HTTP/1.1
Accept-Encoding: gzip
Connection: Keep-Alive
Content-Length: 80
Content-Type: application/json; charset=utf-8
Host: 172.26.213.21:4723
User-Agent: selenium/3.12.0 (java windows)

{"using":"xpath","value":".//*[@LocalizedControlType='edit' and @Name='Email']"}
HTTP/1.1 200 OK
Content-Length: 122
Content-Type: application/json

{"sessionId":"EE9FFAA4-A780-42EF-AA70-39E2E1D8DD4F","status":0,"value":{"ELEMENT":"59fdbf1d-28b2-4a4e-83ca-bd30fc564d9f"}}

==========================================

What could be an issue? Locally it works nice without any Inspect.exe launched, appears only when I switch to remote test execution. Also, I can use only XPath there, as window contains more than one element with similar Name and field has very few attributes, so switching to other way of finding elements is problem.

Thanks for help in advance!

hassanuz commented 6 years ago

Hi @nsavastejevs,

Can you expand further on what app is being used to test (if you're able to provide this information) and also paste page source (XML snapshot)?

rajeeshmenoth commented 6 years ago

Hi @nsavastejevs ,

Which app information you are trying to automate ? outlook or other app ?.

If it possible please share the code snippet.

nsavastejevs commented 6 years ago

Hi @hassanuz @rajeeshmenoth Here are pagesource files (can't attach .xml, so here are text files): Without inspect launched on remote Pagesource_debug - without inspect.txt With Inspect launched on remote Pagesource_debug - with inspect.txt Without Inpect.exe turned on, fields I need are not shown for that window in pagesource, so it's not possible to find them. As I currently know, Inspect should not have any dependencies to WinAppDriver. On local machine it's working fine. Settings (developer mode etc) are same as well on both local and remote.

It's not Outlook, other desktop app (using Chrome for rendering, so time to time it's problem to locate elements and I need to use XPath). Here is app I'm working with: https://openfin.co/partners/#28-stone Error occurs on 1st screen (login).

rajeeshmenoth commented 6 years ago

Hi @nsavastejevs ,

Try the following Xpath :

1) //Edit[@Name='Email'] 2) //*[@LocalizedControlType='edit' and @Name='Email']

nsavastejevs commented 6 years ago

@rajeeshmenoth both selectors your provided are not working for me on remote. I initially was using quite similar selector: {"using":"xpath","value":".//*[@LocalizedControlType='edit' and @Name='Email']"} In comment above I attached pagesource files with Inspect launched and turned off. When Inspect is not launched - there are no elements in main app window, according to data from pagesource.