2

I'm working in Selenium and want to click on an alert box or confirmation through Selenium code in Eclipse. How can I do this?

1
  • a simple alert box can be handled like everything else on the page... Commented Sep 11, 2012 at 12:36

1 Answer 1

2
Alert alert = driver.switchTo().alert();
alert.accept();

On Pavel's suggestion adding the issue I faced with this -

http://code.google.com/p/selenium/issues/detail?id=3544

Note: The issue is random and the code worked for me most of the time. :)

Sign up to request clarification or add additional context in comments.

2 Comments

But there are other issues that you might face.
If there are other issues, write it to your answer :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.