microsoft / WinAppDriver

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

Application under test was upgraded to .net 4.8 and all element requests are timing out #1686

Open VinayBerry opened 2 years ago

VinayBerry commented 2 years ago

The dev team at my org upgraded their WinForms app to .net version 4.8 and all element requests began timing out. The timeout is on the call to find the element and no response is returned after 60 seconds and the server times out. I tried raising the timeout to 4 min but it still times out. It was all working prior to the .net upgrade. Other commands such as windows maximizing and getting title of window still works. But anything involving FindElement times out. I tried also modifying the version to 1.2.99 and using ms:experimental-webdriver: true. Has anyone experienced this before or have any ideas of what could cause this to be the case?

Using: Selenium 4.0.1 with WinAppDriver v1.2.1/v1.2.99 and Appium v5.0.0-beta01

Sample of Logs from Appium where element call is made and connection times out:

2022-02-22 19:43:05:595 [HTTP] <-- GET /wd/hub/session/5b0c7fc5-5cda-4300-8172-ffde6e1ec076/title 200 27 ms - 81
2022-02-22 19:43:05:596 [HTTP] 
2022-02-22 19:43:05:627 [HTTP] Request idempotency key: 6a444302-74f3-4553-a280-c4ce5172190e
2022-02-22 19:43:05:629 [HTTP] --> POST /wd/hub/session/5b0c7fc5-5cda-4300-8172-ffde6e1ec076/element
2022-02-22 19:43:05:629 [HTTP] {"using":"xpath","value":"//*[@AutomationId='txtClaimID']"}
2022-02-22 19:43:05:631 [W3C (5b0c7fc5)] Calling AppiumDriver.findElement() with args: ["xpath","//*[@AutomationId='txtClaimID']","5b0c7fc5-5cda-4300-8172-ffde6e1ec076"]
2022-02-22 19:43:05:632 [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, accessibility id
2022-02-22 19:43:05:632 [WD Proxy] Matched '/element' to command name 'findElement'
2022-02-22 19:43:05:633 [WD Proxy] Proxying [POST /element] to [POST http://127.0.0.1:4724/wd/hub/session/009498D5-33C1-4C43-A5C7-E411B05AB27F/element] with body: {"using":"xpath","value":"//*[@AutomationId='txtClaimID']"}
2022-02-22 19:43:05:635 [WinAppDriver] ==========================================

2022-02-22 19:43:05:635 [WinAppDriver] POST /wd/hub/session/009498D5-33C1-4C43-A5C7-E411B05AB27F/element HTTP/1.1

2022-02-22 19:43:05:635 [WinAppDriver] Accept: application/json, */*

2022-02-22 19:43:05:635 [WinAppDriver] Connection: keep-alive

2022-02-22 19:43:05:635 [WinAppDriver] Content-Length: 59

2022-02-22 19:43:05:636 [WinAppDriver] Content-Type: application/json; charset=utf-8

2022-02-22 19:43:05:636 [WinAppDriver] Host: 127.0.0.1:4724

2022-02-22 19:43:05:636 [WinAppDriver] User-Agent: appium

2022-02-22 19:43:05:636 [WinAppDriver] 

2022-02-22 19:43:05:636 [WinAppDriver] {"using":"xpath","value":"//*[@AutomationId='txtClaimID']"}
2022-02-22 19:44:05:641 [HTTP] <-- POST /wd/hub/session/5b0c7fc5-5cda-4300-8172-ffde6e1ec076/element - - ms - -
2022-02-22 19:44:05:641 [HTTP] 
2022-02-22 19:44:05:642 [HTTP] Could not cache the response identified by '6a444302-74f3-4553-a280-c4ce5172190e', because it has not been completed
2022-02-22 19:44:05:642 [HTTP] Does the client terminate connections too early?
anunay1 commented 2 years ago

Can you downgrade the Appium version to 4.3.1 and Selenium to 3.141.1 and check?

VinayBerry commented 2 years ago

@anunay1 I tried on the lower versions you recommended and still getting same timeout error.

Error:

OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://127.0.0.1:4723/wd/hub/session/51778249-63a3-40a4-8871-133ce539587d/element timed out after 60 seconds.
  ----> System.Net.WebException : The operation has timed out.

Logs:

2022-02-23 16:20:20:215 [HTTP] --> POST /wd/hub/session/51778249-63a3-40a4-8871-133ce539587d/element
2022-02-23 16:20:20:216 [HTTP] {"using":"xpath","value":"//*[@AutomationId='txtClaimID']"}
2022-02-23 16:20:20:220 [W3C (51778249)] Calling AppiumDriver.findElement() with args: ["xpath","//*[@AutomationId='txtClaimID']","51778249-63a3-40a4-8871-133ce539587d"]
2022-02-23 16:20:20:221 [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, accessibility id
2022-02-23 16:20:20:224 [WD Proxy] Matched '/element' to command name 'findElement'
2022-02-23 16:20:20:225 [WD Proxy] Proxying [POST /element] to [POST http://127.0.0.1:4724/wd/hub/session/A08A9938-41FF-49A0-BE0D-548C699852CE/element] with body: {"using":"xpath","value":"//*[@AutomationId='txtClaimID']"}
2022-02-23 16:20:20:227 [WinAppDriver] ==========================================

2022-02-23 16:20:20:227 [WinAppDriver] POST /wd/hub/session/A08A9938-41FF-49A0-BE0D-548C699852CE/element HTTP/1.1

2022-02-23 16:20:20:227 [WinAppDriver] Accept: application/json, */*

2022-02-23 16:20:20:228 [WinAppDriver] Connection: keep-alive

2022-02-23 16:20:20:228 [WinAppDriver] Content-Length: 59

2022-02-23 16:20:20:228 [WinAppDriver] Content-Type: application/json; charset=utf-8

2022-02-23 16:20:20:228 [WinAppDriver] Host: 127.0.0.1:4724

2022-02-23 16:20:20:228 [WinAppDriver] User-Agent: appium

2022-02-23 16:20:20:229 [WinAppDriver] 

2022-02-23 16:20:20:229 [WinAppDriver] {"using":"xpath","value":"//*[@AutomationId='txtClaimID']"}
2022-02-23 16:21:20:251 [HTTP] <-- POST /wd/hub/session/51778249-63a3-40a4-8871-133ce539587d/element - - ms - -
2022-02-23 16:21:20:251 [HTTP] 
anunay1 commented 2 years ago

@VinayBerry I created a winform app with .net framework 4.8 and it works fine.

Shakevg commented 2 years ago

I am also using .Net Framework 4.8 with WinAppDriver for several years and didn't have any issues

VinayBerry commented 2 years ago

@anunay1 yeah its app specific I have also run that experiment of targeting a hello-world app on 4.8 and everything worked ok. I worked around it a little by directly using accessibility ids/names instead of xpath, I guess it was just too slow after the 4.8 upgrade for whatever reason. But there's still issues when the app is spending a lot of time loading the appium connection tends to trigger a timeout. Still havent found a way around that unfortunately.