Thursday, 24 November 2022

TestNG Project Count_card.java file selenium project

package ExtentReports;

import com.aventstack.extentreports.ExtentTest;

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

import java.awt.*;
import java.util.List;

public class Count_Cards extends Load_Test{

@BeforeTest
public void before_count_cards(){

}

@Test
public void count_cards(){
ExtentTest card_test = extent.createTest("Card Count Test");
try{
List<WebElement> elementList = driver.findElements(By.className("inventory_item"));
for (int i = 0; i<elementList.size();i++) {
System.out.println(elementList.get(i));
card_test.log(Status.INFO,"Option: "+elementList.get(i).getText());
extent.flush();
}
card_test.log(Status.PASS,"Cards Count: "+elementList.size());
extent.flush();
}
catch (Throwable t){
//card_test.log(Status.INFO,"Exception: "+t);
//extent.flush();
System.out.println("Card Count Exception: "+t);
}
}

@AfterTest
public void after_count_card(){

}
}

--
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=""...