Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (29.3k points)

I need to click the 'Ok' button inside an alert window with a Selenium command. I've tried assertAlert or verifyAlert but they don't do what I want.

It's possible the click the 'Ok' button? If so, can someone provide me an example of the Selenium IDE command?

1 Answer

0 votes
by (50.2k points)

Refer to the below documentation:

https://www.seleniumhq.org/docs/03_webdriver.jsp#popup-dialogs

driver.switchTo().alert().accept();

This LOC in java will enable you to click ok button inside an alert in selenium ide

 If you are working with ruby then 

Driver.switch_to.alert

This will help you to resolve the problem.

Check out Intellipaat’s Java Selenium online training!

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...