-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHW2.java
More file actions
89 lines (71 loc) · 3.25 KB
/
HW2.java
File metadata and controls
89 lines (71 loc) · 3.25 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package Homework2;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class HW2<WebElementWait> {
WebDriver driver;
@BeforeTest
public void start() throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "drivers\\chromedriver.exe");
driver = new ChromeDriver();
driver.get("https://techfios.com/billing/?ng=login/");
Assert.assertEquals(driver.getTitle(), "Login - iBilling");
}
@Test
public void input() throws Exception {
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.findElement(By.xpath("//*[@id=\"username\"]")).sendKeys("demo@techfios.com");
driver.findElement(By.xpath("//*[@id=\"password\"]")).sendKeys("abc123");
driver.findElement(By.xpath("//button[@type='submit']")).click();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
WebElement Dashboard = driver.findElement(By.xpath("//h2[contains(text(),' Dashboard ')]"));
Assert.assertEquals(Dashboard.getText(), "Dashboard");
driver.findElement(By.xpath("//span[contains(text(),'Customers')]")).click();
driver.findElement(By.xpath("//*[@id=\"side-menu\"]/li[3]/ul/li[1]/a")).click();
driver.findElement(By.xpath("//input[@id='account']")).sendKeys("jim brown");
WebElement company = driver.findElement(By.xpath(("//select[@id='cid']")));
Select sel = new Select(company);
sel.selectByVisibleText("Google");
//Random Number
Random rnd = new Random();
int number = rnd.nextInt(999);
WebElement Email= driver.findElement(By.xpath("//input[@id='email']"));
Email.sendKeys("jim@techfios.com");
driver.findElement(By.xpath("//input[@id='phone']")).sendKeys("2058023");
driver.findElement(By.xpath("//input[@id='address']")).sendKeys("1000 Freeway Lane");
driver.findElement(By.xpath("//input[@id='city']")).sendKeys("Melbourne");
driver.findElement(By.xpath("//input[@id='state']")).sendKeys("TX");
driver.findElement(By.xpath("//input[@id='zip']")).sendKeys("85621");
WebElement Country= driver.findElement(By.xpath("//select[@id='country']"));
WebElement Crime= driver.findElement(By.xpath("//select[@id='group']"));
WebElement Tag= driver.findElement(By.xpath("//select[@id='tags']"));
Select Sel = new Select(Country);
Select Sels= new Select(Tag);
Select Sele= new Select(Crime);
Sel.selectByVisibleText("United States");
Sels.selectByVisibleText("crime");
Sele.selectByVisibleText("AUG 2020");
driver.findElement(By.xpath("//input[@id='password']")).sendKeys("123456");
driver.findElement(By.xpath("//input[@id='cpassword']")).sendKeys("123456");
driver.findElement(By.xpath("//div[@class='toggle-group']"));
driver.findElement(By.xpath("//button[@id='submit']")).click();
driver.findElement(By.xpath("//a[contains(text(),'List Customers')]"));
Thread.sleep(2000);
WebDriverWait wait = new WebDriverWait(driver,10);
Thread.sleep(2000);
}
// @After
public void teardownn() {
driver.close();
driver.quit();
}
}