Last active
December 11, 2021 17:44
-
-
Save veenadevi/9442ed5a492eba088ff214c9a18e1923 to your computer and use it in GitHub Desktop.
Simple Selenium TestNG TestClass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.github.bonigarcia.wdm.WebDriverManager; | |
import org.openqa.selenium.By; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.WebElement; | |
import org.openqa.selenium.chrome.ChromeDriver; | |
import org.testng.Assert; | |
import org.testng.annotations.Test; | |
public class LTPlayGroundTest { | |
@Test //TestNG Annotation | |
public void validateCheckBoxStatus (){ | |
/**WebDriverManager is a open Source API to ease the Browser Initialisation . | |
We can skip driver exe path definition**/ | |
WebDriverManager.chromedriver().setup(); | |
//Chrome Browser Initialised | |
WebDriver driver= new ChromeDriver(); | |
//Launch the URL | |
driver.get("https://www.lambdatest.com/selenium-playground/checkbox-demo"); | |
//get the WebElement of Check Box | |
WebElement singleCheckBox= driver.findElement(By.id("isAgeSelected")); | |
//click that check box | |
singleCheckBox.click(); | |
//Validate checkbox is selected or not | |
Assert.assertTrue(singleCheckBox.isSelected(),"Checkbox is not selected "); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment