@Test public void testUntitled2() throws Exception { driver.get(baseUrl + "php4dvd/"); WebElement userNameWebEdit = driver.findElement(By.id("username")); WebElement passwordWebEdit = driver.findElement(By.name("password")); WebElement subminButton = driver.findElement(By.name("submit")); userNameWebEdit.clear(); userNameWebEdit.sendKeys("admin"); passwordWebEdit.clear(); passwordWebEdit.sendKeys("admin"); subminButton.click(); }
@Test public void testCreateFilm() throws Exception { driver.findElement(By.cssSelector("img[alt=\"Add movie\"]")).click(); driver.findElement(By.name("name")).clear(); driver.findElement(By.name("name")).sendKeys("Новый фильм"); driver.findElement(By.name("year")).clear(); driver.findElement(By.name("year")).sendKeys("1999"); driver.findElement(By.name("duration")).clear(); driver.findElement(By.name("duration")).sendKeys("90"); driver.findElement(By.id("own_no")).click(); driver.findElement(By.id("seen_no")).click(); driver.findElement(By.id("submit")).click(); }
public String getTextByName(String locator) { String st = driver.findElement(By.name(locator)).getText(); return st; }