WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

winappdriver - webdriver wait for WPF element

Open xkasjan77 opened this issue 1 year ago • 1 comments

Hi,

I've created simple methods for locating elements in WPF application. I simply used WebDriverWait which looks like this

try: wait.until(EC.presence_of_element_located((By.ID, element))) except Exception as error: print(error)

The main problem is that when I set time for example 60 seconds and my control show up, script is still looking up for it. Is that normal behaviour of this function? It's pretty same functionality as Time.Sleep(30)

Is there a better usage of wait class for desktop applications?

xkasjan77 avatar May 16 '24 09:05 xkasjan77

Eventually our code converged to the following:

bool WaitFoSomething(funct<bool> check,int timeout)
{
//while loop to check
}

//usage
Assert.IsTrue(WaitForSomething(EC.FindElementsByAccessibilityId("").Any(),5000), "not there is bad");

liljohnak avatar May 17 '24 14:05 liljohnak