I am writing an automated test in Selenium IDE to test one of our applications. Our app throws one of those confirmation dialogs "Are you sure you want to continue." Click OK or Cancel
Selenium does not support the clicking of these dialog boxes. I have tried the following SeleniumIDE functions with no success:
chooseOkOnNextConfirmation
chooseOkOnNextConfirmationAndWait
Is there a JavaScript function I can call within SeleniumIDE to do this, or am I out of luck.
If you are working on IDE the code should be
Command : assertConfirmation
Target : Are you sure you want to continue?
This will help you for sure..
If you are working on WebDriver
, then the code should be
driver.switchTo().alert().accept();
You are going to have to use JavascriptExecutor to press the OK or Cancel button while using Selenium. You could try something along the lines of -
((JavascriptExecutor)driver).executeScript("window.confirm = function(msg){return true;};");
That is of course, without seeing any of your code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With