Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

winappdriver - webdriver wait for WPF element #2003

Open
xkasjan77 opened this issue May 16, 2024 · 1 comment
Open

winappdriver - webdriver wait for WPF element #2003

xkasjan77 opened this issue May 16, 2024 · 1 comment

Comments

@xkasjan77
Copy link

xkasjan77 commented May 16, 2024

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?

@liljohnak
Copy link

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");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants