Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling Alerts #70

Open
khedewy opened this issue Feb 28, 2023 · 0 comments
Open

Handling Alerts #70

khedewy opened this issue Feb 28, 2023 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@khedewy
Copy link

khedewy commented Feb 28, 2023

This how to handle alerts using SHAFT.

package pages;

import com.shaft.driver.SHAFT;
import com.shaft.gui.element.AlertActions;

public class Alerts {
private SHAFT.GUI.WebDriver driver;

public Alerts(SHAFT.GUI.WebDriver driver) {
	this.driver = driver;
}

public void Handling_Alerts() {
	
	// we need to use  AlertActions class ⬇⬇

	AlertActions alert = driver.element().performAlertAction();

	// if you want to accept alert ⬇⬇

	alert.acceptAlert();

	// if you want to dismiss alert ⬇⬇

	alert.dismissAlert();

	// if you want to get a text of an alert ⬇⬇

	alert.getAlertText();

	// if you want to send text into the alert ⬇⬇

	alert.typeIntoPromptAlert("your text");

	// if you want to check if the alert is present ⬇⬇

	alert.isAlertPresent();
}

}

@MohabMohie MohabMohie added this to SHAFT Jul 2, 2023
@MohabMohie MohabMohie added the documentation Improvements or additions to documentation label Jul 2, 2023
@MohabMohie MohabMohie moved this to 🆕 New in SHAFT Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
No open projects
Status: 🆕 New
Development

No branches or pull requests

4 participants