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);

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

Can any one help me to solve this issue?

  • 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

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()){
        if(driver.getTitle().equals("your title")){
           // your code
           wait = new WebDriverWait(oBrowser, stimeout);

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");


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.