package ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class Check_Drop_Down extends Load_Test{
@BeforeTest
public void before_drop_down(){
}
@Test
public void Test(){
ExtentTest drop_test = extent.createTest("Drop Down Test");
try{
WebElement element = driver.findElement(By.xpath("/html/body/div/div/div/div[1]/div[2]/div[2]/span/select"));
Select select = new Select(element);
select.selectByIndex(3);
String option = element.getText();
drop_test.log(Status.INFO,"Selected drop down Option: "+option);
extent.flush();
}
catch (Throwable t){
//drop_test.log(Status.INFO,"Exception: "+t);
//extent.flush();
System.out.println("Drop Down Exception: "+t);
}
}
@AfterTest
public void after_drop_down(){
}
}
With Warm REGARDS,
En. S. WANKHEDE
En. S. WANKHEDE
No comments:
Post a Comment
Welcome, happy learning