// get texts public List<String> getElementTexts(String locator) { List<String> texts = new ArrayList<String>(); List<WebElement> element = new ArrayList<WebElement>(); element = getWebElements(locator); for (WebElement st : element) { texts.add(st.getText()); } return texts; }
@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(); }