-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSActions4.java
More file actions
33 lines (29 loc) · 926 Bytes
/
JSActions4.java
File metadata and controls
33 lines (29 loc) · 926 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
package VINDVG1.Vinay27;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
public class JSActions4 {
public static void main(String[] args) throws InterruptedException {
WebDriverManager.chromedriver().setup();
WebDriver driver = new ChromeDriver();
driver.navigate().to("https://demoqa.com/alerts");
driver.manage().window().maximize();
driver.findElement(By.id("confirmButton")).click();
String src = driver.switchTo().alert().getText();
System.out.println(src);
String sre = "Do you confirm action?";
if(src.equals(sre))
{
System.out.println("Passed");
}
else
{
System.out.println("failed");
}
Thread.sleep(3000);
driver.switchTo().alert().dismiss();
driver.switchTo().parentFrame();
System.out.println(driver.getTitle());
}
}