0

While automating one AJAX application i came across a the below problem.

Scenario: I clicked on an element and the progress bar keeps on loading..I want to wait for the progress bar to stop. How to go ahead this type AJAX elements in Selenium Webdriver using java as the language.

NOTE: When the progress bar is loading, in the background the element is PRESENT..otherwise i would have been used the wait for an element until the element to appear.

Can anyone please help me for the same?

Thanks,

Sudhansu

  • Does this answer your question? [In Selenium Webdriver, ExpectedCondition.elementToBeClickable is not waiting until the progress bar disappears](https://stackoverflow.com/questions/38673465/in-selenium-webdriver-expectedcondition-elementtobeclickable-is-not-waiting-unt) – Matej J Apr 15 '20 at 10:31

1 Answers1

0

Try with below logic.

int i=0;
while(isElementPresent(By.id("ajax_progressbar")))
{
    Thread.sleep(100);
    if(++i>200)
    {
       break;
    }
}
  • Check for the element presence in loop
  • If element disappears break the loop
Santoshsarma
  • 5,627
  • 1
  • 24
  • 39