Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
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!

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...