[Question] Is there a better way to wait for a progress bar to complete?
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:
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?
Hi @liljohnak,
This looks good. Perhaps you could change ".getScreenshot" to something else, like using the Displayed property to verify.
Thank you @hassanuz properties took longer to give me a response, but methods failed instantly.
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?