List of usage examples for org.openqa.selenium WebElement click
void click();
From source file:co.edu.uniandes.csw.bookstore.tests.selenium.pages.review.ReviewListPage.java
License:Open Source License
public void viewReviewDetails(Integer index) { WebElement detailsButton = findDetailsBtnByIndex(index); detailsButton.click(); }
From source file:co.edu.uniandes.csw.bookstore.tests.selenium.pages.score.ScoreListPage.java
License:Open Source License
public void editScore(Integer index) { WebElement editButton = findEditBtnByIndex(index); editButton.click(); }
From source file:co.edu.uniandes.csw.bookstore.tests.selenium.pages.score.ScoreListPage.java
License:Open Source License
public void deleteScore(Integer index) { WebElement deleteButton = findDeleteBtnByIndex(index); deleteButton.click(); }
From source file:co.edu.uniandes.csw.bookstore.tests.selenium.pages.score.ScoreListPage.java
License:Open Source License
public void viewScoreDetails(Integer index) { WebElement detailsButton = findDetailsBtnByIndex(index); detailsButton.click(); }
From source file:co.edu.uniandes.csw.sport.master.test.SportMasterTest.java
/** * CreateUserSport-> Crea un nuevo User y le asocia varios elementos sport * /*from w w w.j a v a 2s.c om*/ */ @Test public void createUserSport() throws Exception { Thread.sleep(2000); driver.get(baseUrl + "/sport.web/userMaster.html"); Thread.sleep(5000); driver.findElement(By.xpath("//button[contains(@id,'createButton')]")).click(); Thread.sleep(2000); driver.findElement(By.id("userName")).clear(); driver.findElement(By.id("userName")).sendKeys("nombre"); driver.findElement(By.id("firstName")).clear(); driver.findElement(By.id("firstName")).sendKeys("nombre1"); driver.findElement(By.id("lastName")).clear(); driver.findElement(By.id("lastName")).sendKeys("nombre2"); //HREF indicando el tab de detalle a seleccionar driver.findElement(By.xpath("//a[contains(@href,'sport')]")).click(); Thread.sleep(2000); driver.findElement(By.xpath("//button[contains(@id,'addButton')]")).click(); //Toma todos los webElement cuyo id sea "selection" y de tipo checkbox. List<WebElement> lst = driver .findElements(By.xpath("//input[contains(@id,'selection')][@type='checkbox']")); for (WebElement lst1 : lst) { if (!lst1.isSelected()) { lst1.click(); // Si no esta seleccionado hace click en el checkbox, agrega todos los deportes existentes } } driver.findElement(By.id("addButton")).click(); List<WebElement> tables = driver.findElement(By.xpath("//div[contains(@id,'sport')]")) .findElements(By.xpath("//table[contains(@class,'table striped')]/tbody/tr")); if (tables.size() != lst.size()) { fail(); } driver.findElement(By.xpath("//button[contains(@id,'saveButton')]")).click(); Thread.sleep(3000); List<WebElement> table = driver .findElements(By.xpath("//table[contains(@class,'table striped')]/tbody/tr")); boolean fail = false; for (WebElement webElement : table) { List<WebElement> elems = webElement.findElements(By.xpath("td")); if (elems.get(0).getText().equals("nombre") && elems.get(1).getText().equals("nombre1")) { fail = true; } } assertTrue(fail); }
From source file:co.edu.uniandes.csw.sport.master.test.SportMasterTest.java
/** * editUserSport-> Edita un User existente que tiene varios sports asociados. 1. Elimina todos los elementos sports asociados 2. Agrega varios sports 3. Verfica que el objeto haya sido actualizado * //from w w w .ja v a 2 s .c o m */ @Test public void editUserSport() throws Exception { driver.get(baseUrl + "/sport.web/userMaster.html"); driver.findElements(By.linkText("Edit")).get(driver.findElements(By.linkText("Edit")).size() - 1).click(); Thread.sleep(2000); driver.findElement(By.id("userName")).clear(); driver.findElement(By.id("userName")).sendKeys("nombre1mod"); driver.findElement(By.id("firstName")).clear(); driver.findElement(By.id("firstName")).sendKeys("nombre2mod"); driver.findElement(By.xpath("//a[contains(@href,'sport')]")).click(); Thread.sleep(2000); List<WebElement> tables = driver .findElements(By.xpath("/html/body/div[1]/div[2]/div/div[2]/div[3]/div/table/tbody/tr")); SportDTO sport; Thread.sleep(2000); for (WebElement table : tables) { driver.findElements(By.linkText("Delete")).get(driver.findElements(By.linkText("Delete")).size() - 1) .click(); Thread.sleep(2000); } driver.findElement(By.xpath("//button[contains(@id,'addButton')]")).click(); List<WebElement> lst = driver .findElements(By.xpath("//input[contains(@id,'selection')][@type='checkbox']")); for (WebElement lst1 : lst) { if (!lst1.isSelected()) { lst1.click(); } } driver.findElement(By.id("addButton")).click(); Thread.sleep(2000); driver.findElement(By.xpath("//button[contains(@id,'saveButton')]")).click(); Thread.sleep(3000); List<WebElement> table = driver .findElements(By.xpath("//table[contains(@class,'table striped')]/tbody/tr")); boolean fail = false; for (WebElement webElement : table) { List<WebElement> elems = webElement.findElements(By.xpath("td")); if (elems.get(0).getText().equals("nombre1mod") && elems.get(1).getText().equals("nombre2mod")) { fail = true; } } assertTrue(fail); }
From source file:co.edu.uniandes.csw.stamps.tests.selenium.pages.stamp.StampListPage.java
License:Open Source License
public void editStamp(Integer index) { WebElement editButton = findEditBtnByIndex(index); editButton.click(); }
From source file:co.edu.uniandes.csw.stamps.tests.selenium.pages.stamp.StampListPage.java
License:Open Source License
public void deleteStamp(Integer index) { WebElement deleteButton = findDeleteBtnByIndex(index); deleteButton.click(); }
From source file:co.edu.uniandes.csw.stamps.tests.selenium.pages.stamp.StampListPage.java
License:Open Source License
public void viewStampDetails(Integer index) { WebElement detailsButton = findDetailsBtnByIndex(index); detailsButton.click(); }
From source file:co.edu.uniandes.csw.stamps.tests.selenium.pages.tShirt.TShirtListPage.java
License:Open Source License
public void editTShirt(Integer index) { WebElement editButton = findEditBtnByIndex(index); editButton.click(); }