0

I have developed selenium automation framework using JAVA and I facing a problem. When I click on any button say Filter or clear filter application display a loading window and after that, we are able to perform next action. i have added following code to wait until loading window visible false but its not working.

wait.until(ExpectedConditions.invisibilityOf(webElement));
                    System.out.println("Wait Untill Loading Window Closed");
                    existFlag=true;

in web element i passing that loading window XPATH. Every time code not wait for window to be closed start clicking on button and throw exception

unknown error: Element ... is not clickable at point (178, 391). Other element would receive the click:

I also added code for click

wait.until(ExpectedConditions.elementToBeClickable(webElement));
             webElement.click();
             return true;

Please help how i can wait till loading window close.

Loading Window

Aman Sharma
  • 311
  • 1
  • 8
  • 22
  • If I understand your question correctly, you see `Element ... is not clickable at point` when using `invisibilityOf` clause. So what is the issue when using `elementToBeClickable` clause? – undetected Selenium Nov 16 '17 at 09:51
  • the issue is script not wait for loading window to be closed and start to clicking on the button and getting this error – Aman Sharma Nov 16 '17 at 11:15
  • `script not wait for loading window to be closed and start to clicking` is happening in first case. How about the `Second` case? Do you see any error? Where are you stuck? – undetected Selenium Nov 16 '17 at 12:42
  • as you see in the image , all the element is present on screen and over that just loading window is displayed, while loading window is visible one cannot click on any button. my script does not wait for the window to be closed and try to click on the button and throw error "unknown error: Element ... is not clickable at point (178, 391)." – Aman Sharma Nov 17 '17 at 06:30
  • If even after inducing `elementToBeClickable` your script `try to click on the button` before `window to be closed` then IMO there is something wrong either in the code or website. Can you share your code block? – undetected Selenium Nov 17 '17 at 06:34
  • Loding Window HTML code body/div[@id='myApp']/div/div[@class='container page-wrap']/div[@class='row']/div[@class='col-xs-12']/div[@class='panel panel-default']/div[@class='panel-body']/div[@class='table-responsive']/div[1]/div[@class='main-preloader-holder']" and button HTML code [@id='myApp']/div/div[@class='container page-wrap']/div[@class='row']/div[@class='col-xs-12']/div[@class='panel panel-default']/div[@class='panel-body']/form[@class='filter-groups']/div[@class='task_buttons']/div[@class='form-group'][1]/button[@class='btn btn-primary'] – Aman Sharma Nov 17 '17 at 06:47
  • Your script as well as the relevant HTML. – undetected Selenium Nov 17 '17 at 06:49
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/159215/discussion-between-aman-sharma-and-debanjanb). – Aman Sharma Nov 17 '17 at 10:26
  • I think you were on the right track with `invisibilityOf` where you were seeing `Element ... is not clickable at point` which is possible duplicate of [Selenium Web Driver & Java. Element is not clickable at point (36, 72). Other element would receive the click:](https://stackoverflow.com/questions/44912203/selenium-web-driver-java-element-is-not-clickable-at-point-36-72-other-el) – undetected Selenium Nov 17 '17 at 10:33
  • But this not help me. – Aman Sharma Nov 27 '17 at 16:13
  • What do you mean by `But this not help me`? Do you see any error? Where are you stuck? – undetected Selenium Nov 27 '17 at 16:26
  • No, there is no error but selenium does not wait until loading window close and start to click on the button . – Aman Sharma Nov 28 '17 at 04:56

3 Answers3

0

You should use implicit wait for this purpose. Add this statement for setting Implicit wait on driver object , after initialising the driver instance.

driver.manage().timeouts().implicitlyWait(Integer.parseInt("30"),TimeUnit.SECONDS);
Manmohan_singh
  • 1,776
  • 3
  • 20
  • 29
  • But in my case all the element is visible on page just loading window is appear over this. – Aman Sharma Nov 16 '17 at 08:35
  • A loading window is like an AJAX event. Implicit waits are meant to set timeout intervals for waiting upon such events . – Manmohan_singh Nov 16 '17 at 08:44
  • "The implicit wait will tell to the web driver to wait for certain amount of time before it throws a "No Such Element Exception". The default setting is 0. Once we set the time, web driver will wait for that time before throwing an exception." But in my case everything is already loaded no ajax – Aman Sharma Nov 16 '17 at 08:47
0

You can use this :

wait.until(ExpectedConditions.visibilityOfElementLocated(webElement));
webElement.click();
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Ram
  • 19
  • 3
0

You can write you personal waiter. I guess, you will got a few cases when you will see this scroller. For example you can try use next approach:

public void waitIfScrollerStillVisibe(int seconds, By locator) {
    int counter = 0;
    while (!isElemenyVisible(locator)) {
        if (counter == seconds) {
            new throw ElementIsNotVisibleException();
        }
        else {
            Thread.sleep(seconds);
            counter++;              
        }

    }
}
Skytrace
  • 58
  • 4