user1662182
user1662182

Reputation: 21

How to get window ID through Java code or through Selenium

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?

Upvotes: 2

Views: 636

Answers (1)

some_other_guy
some_other_guy

Reputation: 3394

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. :)

Upvotes: 2

Related Questions