forked from lerndevops/labs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FirstTestNGTestCase.java
executable file
·39 lines (32 loc) · 1.31 KB
/
FirstTestNGTestCase.java
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
package com.com.hellotest;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class SeleniumWebdriverTest {
@Test
public void MyFirstTestNGTestCase() {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Nareshwar\\Downloads\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.get("http://192.168.198.141:32768/addressbook/");
driver.findElement(By.xpath("//div[@class = 'v-button v-widget']")).click();
driver.findElement(By.id("gwt-uid-5")).sendKeys("Rostow1");
driver.findElement(By.id("gwt-uid-7")).sendKeys("G");
driver.findElement(By.id("gwt-uid-9")).sendKeys("805983095");
driver.findElement(By.id("gwt-uid-11")).sendKeys("[email protected]");
driver.findElement(By.xpath("//div[@class = 'v-button v-widget primary v-button-primary']")).click();
driver.close();
}
@BeforeMethod
public void beforeMethod() {
System.out.println("Executed Before the Test");
}
@AfterMethod
public void afterMethod() {
System.out.println("Executed After the Test");
}
}