licanhua / wdio-winappdriver-example

Example to demonstrate the integration of wdio + winappdriver/ywinappdriver
3 stars 2 forks source link

Click is not a function .... #1

Open Divyaa123 opened 3 years ago

Divyaa123 commented 3 years ago

Hi , I made clone of this repo and followed same instructions like npm install etc ... When I am running test script - I am able to launch application but it says click is not a function...

Capture

licanhua commented 3 years ago

It's possible that the alarm automation id is changed. check the winappdriver log first

Divyaa123 commented 3 years ago

Hi ,

I have checked ... All Ids are same .

[image: image.png]

On Fri, Jul 2, 2021 at 11:34 PM Canhua Li @.***> wrote:

It's possible that the alarm automation id is changed. check the winappdriver log first

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/licanhua/wdio-winappdriver-example/issues/1#issuecomment-873267556, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKXLQ3BBPTVP5X3NOLCUHLDTVYWFHANCNFSM47RYVMEA .

licanhua commented 3 years ago

I guess there is the log like winappdriver.log in .\reports, and you should open that log

Divyaa123 commented 3 years ago

sorry , I dont understand what to check here exactly ? -

On Fri, Jul 2, 2021 at 11:45 PM Canhua Li @.***> wrote:

I guess there is the log like winappdriver.log in .\reports, and you should open that log

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/licanhua/wdio-winappdriver-example/issues/1#issuecomment-873271519, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKXLQ3BBQJNNS6WDS7UA2FTTVYXRJANCNFSM47RYVMEA .

Divyaa123 commented 3 years ago

Can you please try to run your own example and see if it works for you now ? ....that was updated 7 months ago..

On Sat, Jul 3, 2021 at 12:07 AM Divyaa Agnihotri @.***> wrote:

sorry , I dont understand what to check here exactly ? -

On Fri, Jul 2, 2021 at 11:45 PM Canhua Li @.***> wrote:

I guess there is the log like winappdriver.log in .\reports, and you should open that log

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/licanhua/wdio-winappdriver-example/issues/1#issuecomment-873271519, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKXLQ3BBQJNNS6WDS7UA2FTTVYXRJANCNFSM47RYVMEA .

licanhua commented 3 years ago

I don't have nodejs dev environment anymore. also you have to learn how to troubleshooting.

when you run npm run test, there is a reports\ generated, and there is a log which is the message which is interacting with WinAppDriver, and that log will provide the details

nareshbabukanagala commented 2 years ago

========================================== POST /session HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Length: 286

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

{"capabilities":{"alwaysMatch":{"app":"Microsoft.WindowsCalculator_8wekyb3d8bbwe!App","ms:experimental-webdriver":false,"browserName":""},"firstMatch":[{}]},"desiredCapabilities":{"app":"Microsoft.WindowsCalculator_8wekyb3d8bbwe!App","ms:experimental-webdriver":false,"browserName":""}} HTTP/1.1 200 OK

Content-Length: 161

Content-Type: application/json

{"sessionId":"7C5D25DD-5D67-4946-AFF4-E2BF43E5A168","status":0,"value":{"app":"Microsoft.WindowsCalculator_8wekyb3d8bbwe!App","ms:experimental-webdriver":false}}

========================================== POST /session/7C5D25DD-5D67-4946-AFF4-E2BF43E5A168/timeouts HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Length: 29

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

{"type":"implicit","ms":5000} HTTP/1.1 200 OK

Content-Length: 63

Content-Type: application/json

{"sessionId":"7C5D25DD-5D67-4946-AFF4-E2BF43E5A168","status":0}

========================================== POST /session/7C5D25DD-5D67-4946-AFF4-E2BF43E5A168/timeouts HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Length: 29

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

HTTP/1.1 200 OK

Content-Length: 63

Content-Type: application/json

{"sessionId":"7C5D25DD-5D67-4946-AFF4-E2BF43E5A168","status":0}

========================================== POST /session/7C5D25DD-5D67-4946-AFF4-E2BF43E5A168/timeouts HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Length: 29

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

{"type":"implicit","ms":5000} HTTP/1.1 200 OK

Content-Length: 63

Content-Type: application/json

{"sessionId":"7C5D25DD-5D67-4946-AFF4-E2BF43E5A168","status":0}

========================================== POST /session/7C5D25DD-5D67-4946-AFF4-E2BF43E5A168/element HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Length: 49

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

========================================== GET /session/7C5D25DD-5D67-4946-AFF4-E2BF43E5A168/source HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

========================================== GET /session/7C5D25DD-5D67-4946-AFF4-E2BF43E5A168/screenshot HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

========================================== POST /session/7C5D25DD-5D67-4946-AFF4-E2BF43E5A168/timeouts HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Length: 29

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

Hi , I am also facing the same issue. Below is the log

HTTP/1.1 200 OK

Content-Length: 63

Content-Type: application/json

{"sessionId":"7C5D25DD-5D67-4946-AFF4-E2BF43E5A168","status":0}

licanhua commented 2 years ago

Have you changed any config? ms:experimental-webdriver should be true but it's false in your log

nareshbabukanagala commented 2 years ago

Yes. While debugging I changed.updated to true and below is the log

========================================== POST /session HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Length: 284

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

{"capabilities":{"alwaysMatch":{"app":"Microsoft.WindowsCalculator_8wekyb3d8bbwe!App","ms:experimental-webdriver":true,"browserName":""},"firstMatch":[{}]},"desiredCapabilities":{"app":"Microsoft.WindowsCalculator_8wekyb3d8bbwe!App","ms:experimental-webdriver":true,"browserName":""}} HTTP/1.1 200 OK

Content-Length: 160

Content-Type: application/json

{"sessionId":"A814FB8D-C8B6-4D76-ADDA-045764D9A288","status":0,"value":{"app":"Microsoft.WindowsCalculator_8wekyb3d8bbwe!App","ms:experimental-webdriver":true}}

========================================== POST /session/A814FB8D-C8B6-4D76-ADDA-045764D9A288/timeouts HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Length: 29

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

{"type":"implicit","ms":5000} HTTP/1.1 200 OK

Content-Length: 76

Content-Type: application/json

{"sessionId":"A814FB8D-C8B6-4D76-ADDA-045764D9A288","status":0,"value":null}

========================================== POST /session/A814FB8D-C8B6-4D76-ADDA-045764D9A288/element HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Length: 49

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

{"using":"accessibility id","value":"num5Button"}

========================================== GET /session/A814FB8D-C8B6-4D76-ADDA-045764D9A288/screenshot HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

========================================== GET /session/A814FB8D-C8B6-4D76-ADDA-045764D9A288/source HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

========================================== GET /session/A814FB8D-C8B6-4D76-ADDA-045764D9A288/log/types HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

WinAppDriver::CommandHandler::Session::HandleCommandAsMidPoint - Command log is not recognized

HTTP/1.1 404 Not Found

Content-Length: 145

Content-Type: application/json

{"status":9,"value":{"error":"unknown command","message":"Command not recognized: GET: /session/A814FB8D-C8B6-4D76-ADDA-045764D9A288/log/types"}}

========================================== GET /session/A814FB8D-C8B6-4D76-ADDA-045764D9A288/log/types HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

WinAppDriver::CommandHandler::Session::HandleCommandAsMidPoint - Command log is not recognized

HTTP/1.1 404 Not Found

Content-Length: 145

Content-Type: application/json

{"status":9,"value":{"error":"unknown command","message":"Command not recognized: GET: /session/A814FB8D-C8B6-4D76-ADDA-045764D9A288/log/types"}}

========================================== GET /session/A814FB8D-C8B6-4D76-ADDA-045764D9A288/log/types HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

WinAppDriver::CommandHandler::Session::HandleCommandAsMidPoint - Command log is not recognized

HTTP/1.1 404 Not Found

Content-Length: 145

Content-Type: application/json

{"status":9,"value":{"error":"unknown command","message":"Command not recognized: GET: /session/A814FB8D-C8B6-4D76-ADDA-045764D9A288/log/types"}}

========================================== GET /session/A814FB8D-C8B6-4D76-ADDA-045764D9A288/log/types HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

WinAppDriver::CommandHandler::Session::HandleCommandAsMidPoint - Command log is not recognized

HTTP/1.1 404 Not Found

Content-Length: 145

Content-Type: application/json

========================================== DELETE /session/A814FB8D-C8B6-4D76-ADDA-045764D9A288 HTTP/1.1

Accept: application/json

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Type: application/json; charset=utf-8

Host: 127.0.0.1:4723

User-Agent: webdriver/6.10.0

HTTP/1.1 200 OK

Content-Length: 455770

Content-Type: application/json

qC7pxpxJdKxw8sw410sosmE9gBTeaUAdwKm6NyOKjaQ6M/QCada+7iWrXq8el5uBGO/3/2f/X79BsuZmCgYvHx7fcAoiEJiSWGjIRJ26gryRFMVWLwZrPdyLOaRslK0jzobaAuw6G83TzoAkn+Z6c3g83o1IyKEyKgW3kRA9dM4OO58nq3n6c73L7qdrDlElOzhxGs9THa05ORzEtJ5NGiXlAM4Aotcm0y6M8ThJjTflRnZV3Qgskb7ahOoQFCBBKRfVNWswFYqSljh1cC60ej1ATtQ8xYeqoLRFUs1i81uvJSIb4CRbrSgUiaZwU/VCp55btSLxSNdOxviMReNYjUCR6G3mF7ZcfTqC9KxtF6ZjOd9rTO01SgAlFbmlwtIGnm4GtNdU3ZnGm960HMB1KsKLMR4nqfGm3MiuqhuBJdJXm1AdggIkK [...] HTTP/1.1 200 OK

Content-Length: 22

Content-Type: application/json

{"status":0,"value":1}

licanhua commented 2 years ago

From the log, likely the calculator app is launched, but winappdriver didn't provide the response for num5Button on time. I expect something like this:

POST /session/499E384F-FA9C-4EA0-8A7C-D2954B3AEA63/element HTTP/1.1
...
User-Agent: webdriver/6.12.1
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."}}
==========================================

It's possible:

  1. WinAppDriver performance problem. change to another version of WinAppDriver. For example, v1.2-RC
  2. wdio timeout before the response. you may change the time to minutes to see what will happen
    defaultTimeoutInterval: 300000,
  3. my example is @wdio/sync, if you changed the dependency, you have to use await in the test case.