Skip to content

Instantly share code, notes, and snippets.

@veenadevi
Last active April 20, 2022 08:48
Show Gist options
  • Save veenadevi/124ba81c48eb830f5fb04059bf342412 to your computer and use it in GitHub Desktop.
Save veenadevi/124ba81c48eb830f5fb04059bf342412 to your computer and use it in GitHub Desktop.
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 LTSimpleFormTest {
@Test //TestNG Annotation
public void validateCheckBoxStatus (){
/**WebDriverManager is an open Source API to ease the Browser Initialisation .
We can skip driver exe path definition**/
WebDriverManager.chromedriver().setup();
//Chrome Browser Initialized
WebDriver driver= new ChromeDriver();
//Launch the URL
driver.get("https://www.lambdatest.com/selenium-playground/simple-form-demo");
//get the WebElement of textInput
WebElement userTestBox= driver.findElement(By.id("user-message"));
///send values to textbox
userTestBox.sendKeys("Welcome To LambdaTest");
WebElement getValueButton= driver.findElement(By.id("showInput"));
getValueButton.click();
WebElement checktextArea= driver.findElement(By.id("message"));
//validate the fetched text
Assert.assertEquals(checktextArea.getText(),"Welcome To LambdaTest","Message is different");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment