package ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import org.openqa.selenium.By;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class Check_Logging_In extends Load_Test{
@BeforeTest
public void before_login(){
}
@Test
public void Login(){
ExtentTest login_test = extent.createTest("Login with USERNAME & PASSWORD Test");
try{
driver.findElement(By.id("user-name")).sendKeys("standard_user");
driver.findElement(By.id("password")).sendKeys("secret_sauce");
driver.findElement(By.id("login-button")).click();
String username = driver.findElement(By.id("user-name")).getText();
login_test.log(Status.INFO, "Username: "+username);
login_test.log(Status.INFO,"Logging in: Pass");
extent.flush();
}
catch (Throwable t){
//login_test.log(Status.INFO, "Exception: "+t);
//System.out.println("Exception: "+t);
System.out.println("Logging in: "+t);
}
}
@AfterTest
public void after_login(){
}
}
With Warm REGARDS,
En. S. WANKHEDE
En. S. WANKHEDE
No comments:
Post a Comment
Welcome, happy learning