Exercise

hint

@Test
public void lab1(){
	System.setProperty("webdriver.gecko.driver","C:\\testautomatisering\\geckodriver.exe");
	WebDriver driver = new FirefoxDriver();

	driver.get("http://damberg.one/lab/lab2a.html");

	driver.findElement(By.id("cname")).clear();
	driver.findElement(By.id("cname")).sendKeys("Zington");

	driver.findElement(By.id("btn")).click();

	Assert.assertTrue(driver.switchTo().alert().getText().contains("Yippie"));
	driver.switchTo().alert().dismiss();

	driver.quit();
}        
		

The goal of this exercise is to be able to clear a field prior to entering text in it.

Task

Create an automated test that make sure the name field value equals the string 'Zington'. To achieve this you need to create a script that either clear the field and send keys to it, or setting the value of it.


Test task panel