forked from TalhaBinAshraf1/SeleniumTestingInternetHerokuApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlertActions.java
More file actions
37 lines (30 loc) · 724 Bytes
/
Copy pathAlertActions.java
File metadata and controls
37 lines (30 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package allTests;
//import com.relevantcodes.extentreports.LogStatus;
public class AlertActions extends BaseTest{
public void isAlertPresent(){
Wait.forAlertToBePresent();
}
public void isAlertPresent(int customTimeout){
Wait.forAlertToBePresent(customTimeout);
}
public void acceptAlert(){
isAlertPresent();
alert = driver.switchTo().alert();
alert.accept();
}
public void dismissAlert(){
isAlertPresent();
alert = driver.switchTo().alert();
alert.dismiss();
}
public String getAlertText(){
isAlertPresent();
alert = driver.switchTo().alert();
String tempText = alert.getText().trim();
alert.accept();
if(tempText.length() > 0){
return tempText;
}
return null;
}
}