Carles Andres
Carles Andres

Reputation: 1811

Click alert button with Selenium Builder

I am using the Selenium Builder Firefox plugin to generate my acceptance tests and I need to confirm certain actions that prompt a confirm dialog.

Is it possible to instruct Selenium Builder to click on the "OK" or the "Cancel" buttons?

Upvotes: 0

Views: 397

Answers (1)

user3487861
user3487861

Reputation: 350

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

//Getting alert text alert.getText();

alert.accept(); // Clicking OK Button

alert.dismiss(); // Clicking Cancel Button

Upvotes: 1

Related Questions