0

When I click one submit button, One pop up (Modal) window get open.

Here I have to click on any one of the buttons among the list of the button. So after clicking on the submit button, I am using wait function to wait till the element to be clickable.

wait = new WebDriverWait(oBrowser, stimeout);
wait.until(ExpectedConditions.elementToBeClickable(ele));

But the program was stuck here. It will not click on any button.

Can any one help me to solve this issue?

closed as unclear what you're asking by c32hedge, alecxe Sep 25 '17 at 19:25

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • please share your exception as well, please check answer as well. – Sagar007 Sep 6 '17 at 8:31
  • 1
    What happens when you get rid of the wait and you put a sleep in front of trying to click it with enough time to make sure it appears? My guess is you'll get some exception, which is why elementToBeClickable isn't returning. You're probably waiting for the wrong element, and trying to click the wrong element as well. That's the best guess I can offer since there is no html or selector in the question. Hope that helps :) – mrfreester Sep 7 '17 at 14:30
1

In questions , There is one new window get opened. As per selenium documentations, script can not work with two window simultaneously.

So solution is script need to move to that screen/window/frame.

As per my knowledge, there are two possibilities :

1. Browser Window :

  • First switch to window and make script

       // Switch to new window opened
        for(String winHandle : driver.getWindowHandles()){
        driver.switchTo().window(winHandle);
        if(driver.getTitle().equals("your title")){
           // your code
           wait = new WebDriverWait(oBrowser, stimeout);
           wait.until(ExpectedConditions.elementToBeClickable(ele));
         }
        }
    

2. Frame :

  • First switch to frame and do script actions (Note : you would see <iframe> tag in HTML page )

    By Index : driver.switchTo().frame(0);

    By Name : driver.switchTo().frame("name of the iframe element");

    By ID : driver.switchTo().frame("id of the iframe element");

Reference


Note : May be that modal window is integrated with existing window. Please check your page loaded properly or not.

Not the answer you're looking for? Browse other questions tagged or ask your own question.