-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextent_report.java
More file actions
44 lines (37 loc) · 1.3 KB
/
extent_report.java
File metadata and controls
44 lines (37 loc) · 1.3 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
package selenium;
import java.io.File;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import com.relevantcodes.extentreports.ExtentReports;
import com.relevantcodes.extentreports.ExtentTest;
import com.relevantcodes.extentreports.LogStatus;
public class report {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C://Users//admin//workspace//Auto/chromedriver.exe");
WebDriver driver = new ChromeDriver();
String baseUrl = "https://www.wufoo.com/html5/maxlength-attribute/";
driver.manage().window().maximize();
driver.get(baseUrl);
WebElement text = driver.findElement(By.xpath("//input[@maxlength='10']"));
String max = text.getAttribute("maxlength");
System.out.println(max);
ExtentReports report = new ExtentReports(System.getProperty("user.dir")+"\\result.html");
ExtentTest test ;
report.loadConfig(new File(System.getProperty("user.dir")+"\\extent-config.xml"));
test = report.startTest("demo");
if(max.equals("10"))
{
test.log(LogStatus.PASS, "passed");
System.out.println("test passed");
}
else
{
test.log(LogStatus.FAIL, "fail");
System.out.println("test failed");
}
report.endTest(test);
report.flush();
}
}