Hi All,

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

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/966cb4cb-004c-4c75-8901-2470283d0ba2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • David Lai at Jan 3, 2014 at 5:43 pm
    I think you can get a reference to the loading progress bar. Then you can
    put a try/catch poll on it. When the element turns stale, is when it goes
    off the screen.

    waitForProgressBarToDisappear() {
       WebElement progressBar = ...;
       while(true) {
         try {
            if (progressBar.isDisplayed())
               return True;
         } catch (StaleElementException) {
            return true;
         }
        sleep(1000);
       }
    }

    another approach if your web app uses jQuery. jQuery has different queues
    you can poll on. There's an animations queue, if you want to poll if the
    progress bar is still moving, and there's and Ajax queue, if you want to
    check how many outstanding requests there are waiting to return. Both are
    very helpful for working with responsive single page Ajax applications.

    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
    To post to this group, send email to [email protected].
    To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/18a91a37-7bdc-4e56-8829-4563a7e1c0ee%40googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Sudhansu Sekhar panda at Jan 4, 2014 at 7:25 am
    Hi David,

    How to get the locator of the progress bar so that i can replace in place
    of "..."..Can you please help me?

    Thanks,
    Sudhansu
    On Friday, 3 January 2014 23:13:33 UTC+5:30, David Lai wrote:

    I think you can get a reference to the loading progress bar. Then you can
    put a try/catch poll on it. When the element turns stale, is when it goes
    off the screen.

    waitForProgressBarToDisappear() {
    WebElement progressBar = ...;
    while(true) {
    try {
    if (progressBar.isDisplayed())
    return True;
    } catch (StaleElementException) {
    return true;
    }
    sleep(1000);
    }
    }

    another approach if your web app uses jQuery. jQuery has different queues
    you can poll on. There's an animations queue, if you want to poll if the
    progress bar is still moving, and there's and Ajax queue, if you want to
    check how many outstanding requests there are waiting to return. Both are
    very helpful for working with responsive single page Ajax applications.
    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
    To post to this group, send email to [email protected].
    To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/978edf9d-b9ca-4a22-9661-5d518335587f%40googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Oscar Rieken at Jan 4, 2014 at 7:30 am
    right click inspect element. I think you should take some time and learn
    your tools.

    On Sat, Jan 4, 2014 at 2:24 AM, Sudhansu Sekhar panda wrote:

    Hi David,

    How to get the locator of the progress bar so that i can replace in place
    of "..."..Can you please help me?

    Thanks,
    Sudhansu

    On Friday, 3 January 2014 23:13:33 UTC+5:30, David Lai wrote:

    I think you can get a reference to the loading progress bar. Then you
    can put a try/catch poll on it. When the element turns stale, is when it
    goes off the screen.

    waitForProgressBarToDisappear() {
    WebElement progressBar = ...;
    while(true) {
    try {
    if (progressBar.isDisplayed())
    return True;
    } catch (StaleElementException) {
    return true;
    }
    sleep(1000);
    }
    }

    another approach if your web app uses jQuery. jQuery has different
    queues you can poll on. There's an animations queue, if you want to poll
    if the progress bar is still moving, and there's and Ajax queue, if you
    want to check how many outstanding requests there are waiting to return.
    Both are very helpful for working with responsive single page Ajax
    applications.
    --
    You received this message because you are subscribed to the Google Groups
    "Selenium Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to [email protected].
    To post to this group, send email to [email protected].
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/selenium-users/978edf9d-b9ca-4a22-9661-5d518335587f%40googlegroups.com
    .

    For more options, visit https://groups.google.com/groups/opt_out.
    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
    To post to this group, send email to [email protected].
    To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CACuB3fa4rFhS6ZNC37XX1FfGC6OzgjQFQaps%3DUU%3DY_KcTbMAtQ%40mail.gmail.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Keerthi sree at Jan 6, 2014 at 8:47 am
    hi...
    i hv installed selenium....im trying to open mozilla firefox browser using
    selenium...but im getting class
    not found exception.....plz help me

    On Fri, Jan 3, 2014 at 11:13 PM, David Lai wrote:

    I think you can get a reference to the loading progress bar. Then you can
    put a try/catch poll on it. When the element turns stale, is when it goes
    off the screen.

    waitForProgressBarToDisappear() {
    WebElement progressBar = ...;
    while(true) {
    try {
    if (progressBar.isDisplayed())
    return True;
    } catch (StaleElementException) {
    return true;
    }
    sleep(1000);
    }
    }

    another approach if your web app uses jQuery. jQuery has different queues
    you can poll on. There's an animations queue, if you want to poll if the
    progress bar is still moving, and there's and Ajax queue, if you want to
    check how many outstanding requests there are waiting to return. Both are
    very helpful for working with responsive single page Ajax applications.

    --
    You received this message because you are subscribed to the Google Groups
    "Selenium Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to [email protected].
    To post to this group, send email to [email protected].
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/selenium-users/18a91a37-7bdc-4e56-8829-4563a7e1c0ee%40googlegroups.com
    .
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
    To post to this group, send email to [email protected].
    To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CA%2BEzhHAHvunonJnYOSpOLpuyRvGNoWFTAtWZJ19R1jXmvbY0LA%40mail.gmail.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Abhay Rai at Jan 6, 2014 at 8:47 am
    Hi,
        You can use jquery to solve this problem.
    below is the code

    public boolean waitForJQueryProcessing(WebDriver driver,
                 int timeOutInSeconds) {
             boolean jQcondition = false;
             try {
                 driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
    // nullify

    // implicitlyWait()
                 new WebDriverWait(driver, timeOutInSeconds) {
                 }.until(new ExpectedCondition<Boolean>() {

                     @Override
                     public Boolean apply(WebDriver driverObject) {
                         return (Boolean) ((JavascriptExecutor) driverObject)
                                 .executeScript("return jQuery.active == 0");

                     }
                 });
                 jQcondition = (Boolean) ((JavascriptExecutor) driver)
                         .executeScript("return jQuery.active == 0");
                 System.out.println(jQcondition);
                 driver.manage().timeouts().implicitlyWait(120,
    TimeUnit.SECONDS); // reset

         // implicitlyWait
                 return jQcondition;
             } catch (Exception e) {
                 e.printStackTrace();
             }
             return jQcondition;
         }

    }
    On Friday, January 3, 2014 3:34:48 PM UTC+5:30, Sudhansu Sekhar panda wrote:

    Hi All,

    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
    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
    To post to this group, send email to [email protected].
    To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/63027b86-9b95-43fe-9b2d-5e3f3553f058%40googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupselenium-users @
categoriesselenium
postedJan 3, '14 at 10:04a
activeJan 6, '14 at 8:47a
posts6
users5
websiteseleniumhq.org

People

Translate

site design / logo © 2023 Grokbase