microsoft / WinAppDriver

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

Element.Displayed issue after some time #928

Open Edv1ser opened 4 years ago

Edv1ser commented 4 years ago

Hello, I'm having this strange issue with my code. I set up a function to wait for element to be clickable, and it is working for some time. Winappdriver log is waiting for element to be clickable, repeatedly checking the element untill its clickable and clicks it, but when time comes for another element, winappdriver just shows value false (not clickable) and is not looking at it anymore. Then script just catches timeout exception.

WebDriverWait wait = new WebDriverWait(CAsession, TimeSpan.FromSeconds(60)); wait.Until(Conditions.ElementToBeClickable(GUIElement));

Any help would be appreciated. EDIT: forgot to mention, that once I rebuild solution, function starts working again, and so on and on...

Edv1ser commented 4 years ago

EDIT: forgot to mention, that once I rebuild solution, function starts working again, and so on and on...

Edv1ser commented 4 years ago

Code starts working after cleaning up solution as well.

anunay1 commented 4 years ago

is the element visible in inspect.exe

naeemakram commented 4 years ago

Looks like an API bug... Have you tried a different technique, something other than the Conditions class? Like, maybe a Thread.Sleep(1000) before calling the until. Or even an until with different parameters.

PandaMagnus commented 4 years ago

Are you instantiating a new WebDriverWait before the next check, or using the same one? If the same one, does CAsession know about the new element (achievable by doing something like what @naeemakram suggested and putting a Thread.Sleep after the first wait.Until, and then doing a CAsession.PageSource and manually looking for the element.)

As a tangential comment, if you're using C#, you should scrap the Conditions class and build you're own wait conditions, custom to your solution.