I run a test script where in a pop up window a confirmation needs to be clicked:

css=#mod-fap-search-overview-confirmDialogButton2 > div

Unfortunately, this pop up is not always displayed hence I want Selenium IDE to continue and not wait for it to click it.

What is the trick on doing so ?

  • many thx for your anser and apologies on coming back so late to it. I am not familiar with "writing" code in selenium IDE rather than recording and modifying it. May it be possible to have some more hints pls ?
    – user55473
    Feb 14 at 10:06

3 Answers 3


There will be such a tricky scenarios. To handle this:

  • You can write step if pop-up #mod-fap-search-overview-confirmDialogButton2 is displayed then click on button
  • Else continue and you have to apply timeout for this. Approx 10 sec may be, pls that you take a decision how much secs it needed?
  • Additional info : If pop-up don't appear still execution will wait for 5/10 sec for pop-up and continue without pop-up

There are multiple workarounds to handle such scenarios while doing web automation using Selenium IDE. While working in test automation services company and developing frameworks in multiple languages below are top 03 approaches widely used -

Method 1 - Use Selenium's isDisplayed() method. If Popup is displayed, click required element else bypass the click. This will require Selenium waits as well.

Method 2 - If assertions are implemented, use SoftAssertions which will not stop your execution but will highlight the failed part in your report.

Method 3 - If multiple attempts are required to validate popup, then use combination of While loops along with Boolean variables.


In Selenium IDE, you can use the "verifyElementPresent" command to check if the element is present before clicking on it. If the element is not present, the test will continue without clicking on it.

Here is an example of how to use "verifyElementPresent" before clicking on the confirmation button:

1 Add the "verifyElementPresent" command before the "click" command in the Selenium IDE test script.

2 Set the target of the "verifyElementPresent" command to the CSS selector of the confirmation button:

Target: css=#mod-fap-search-overview-confirmDialogButton2 > div

3 Save and run the test.

If the confirmation button is present, the test will click on it as usual. If it is not present, the "verifyElementPresent" command will fail, but the test will continue to execute without clicking on the button.

You can also use the "try/catch" block to catch the exception and continue with the test execution. Here is an example:

try {
    click | css=#mod-fap-search-overview-confirmDialogButton2 > div
} catch (Exception e) {
    echo | Element not found: ${e}

This code will try to click on the confirmation button, and if it fails, it will echo the error message and continue with the test execution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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