Thursday, 24 November 2022

TestNG Project check_page_info..java file selenium test case

package ExtentReports;

import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import org.openqa.selenium.By;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class Check_Page_Info extends Load_Test{

@BeforeTest
public void before_Page_Info(){

}

@Test
public void Test_Page_Info(){
ExtentTest page_test = extent.createTest("Page Test");

try{
String page_title = driver.findElement(By.className("title")).getText();
if(page_title == "PRODUCTS"){
page_test.log(Status.INFO,page_title+" - Page loaded: Pass");
page_test.log(Status.INFO, new Throwable());
extent.flush();
}
else{
page_test.log(Status.INFO,page_title+" - Page Not Loaded: Fail");
page_test.log(Status.INFO, new Throwable());
extent.flush();
}

}
catch (Throwable t){
page_test.log(Status.INFO,"Exception Generated: "+t);
System.out.println("Exception: "+t);
extent.flush();
}
}
}

--
With Warm REGARDS,

En. S. WANKHEDE

No comments:

Post a Comment

Welcome, happy learning

Charactor_At_Position

public class Char_At_Position { public static void main(String[] args) { String str = "Wankhede"; String rev=""...