WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

[Question] Is there a better way to wait for a progress bar to complete?

Open liljohnak opened this issue 7 years ago • 3 comments

Is there a better way to wait for a progress bar to complete?

var progressBar = mainWindow.FindElementByClassName("Window").FindElementByAccessibilityId("progressor");
      WebDriverWait waitProgressBar = new WebDriverWait(_session, new TimeSpan(0, 0, 15));
      waitProgressBar.PollingInterval = new TimeSpan(0, 0, 0, 0, 50);
      waitProgressBar.Until(driver =>
      {
        try
        {
          progressBar.GetScreenshot();
          return false;
        }
        catch (Exception)
        { }
        return true;
      }
      );

Details if needed: progressbar Desktop application. During the course of testing this application, I would like to wait for controls to appear and disappear. That is, running processes on the application that take longer than 5 seconds should alert the user with a progress bar. This should temporarily pause the test until the progress bar is gone. Per the above code this is what I could come up with that was responsive to my application, but I feel that this can be improved. Are there any suggestions?

liljohnak avatar Feb 22 '19 19:02 liljohnak

Hi @liljohnak,

This looks good. Perhaps you could change ".getScreenshot" to something else, like using the Displayed property to verify.

hassanuz avatar Feb 26 '19 23:02 hassanuz

Thank you @hassanuz properties took longer to give me a response, but methods failed instantly.

liljohnak avatar Feb 27 '19 01:02 liljohnak

Hi @hassanuz when I use Displayed instead of GetScreenshot, I got error Non-invocable member RemoteWebElement.Displayed cannot be used like a method! Any suggestions?

Saif4 avatar Mar 07 '19 09:03 Saif4