forked from TalhaBinAshraf1/SeleniumTestingInternetHerokuApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotificationMessages.java
More file actions
30 lines (24 loc) · 1.02 KB
/
Copy pathNotificationMessages.java
File metadata and controls
30 lines (24 loc) · 1.02 KB
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
package allTests;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import utility.FrameworkConstants;
public class NotificationMessages {
public static void main(String[] args) throws InterruptedException {
System.setProperty(FrameworkConstants.CHROME_DRIVER_KEY,FrameworkConstants.CHROME_DRIVER_PATH);
WebDriver driver = new ChromeDriver();
driver.get("http://the-internet.herokuapp.com/");
driver.findElement(By.xpath("//a[contains(text(),'Notification Messages')]")).click();
System.out.println(driver.findElement(By.xpath("//div[@id='flash-messages']/div")).getText());
boolean flag = true;
while(flag==true) {
driver.findElement(By.linkText("Click here")).click();
System.out.println(driver.findElement(By.xpath("//div[@id='flash-messages']/div")).getText());
if(driver.findElement(By.xpath("//div[@id='flash-messages']/div")).getText().contains("successful")){
flag=false;
}
}
Thread.sleep(3000);
driver.quit();
}
}