-
Notifications
You must be signed in to change notification settings - Fork 572
Expand file tree
/
Copy pathSignInTest.java
More file actions
38 lines (25 loc) · 1.1 KB
/
SignInTest.java
File metadata and controls
38 lines (25 loc) · 1.1 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
31
32
33
34
35
36
37
38
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.Test;
public class SignInTest extends TestBase {
WebDriver driver = new ChromeDriver();
@Test
public void shouldThrowAnErrorIfSignInDetailsAreMissing() throws InterruptedException {
setDriverPath();
driver.get("https://www.cleartrip.com/");
driver.findElement(By.linkText("Your trips")).click();
driver.findElement(By.id("SignIn")).click();
driver.switchTo().frame("modal_window");
Thread.sleep(10000);
WebElement element = driver.findElement(By.id("signInButton"));
JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("arguments[0].click();", element);
String errors1 = driver.findElement(By.id("errors1")).getText();
Assert.assertTrue(errors1.contains("There were errors in your submission"));
driver.quit();
}
}