List of usage examples for org.openqa.selenium By id
public static By id(String id)
From source file:co.edu.uniandes.Callys.web.test.CallysTest.java
@Test public void t6addToCart() throws Exception { boolean success = false; driver.findElement(By.id("shirt")).click(); Thread.sleep(3000);//from w w w .java 2s . c o m driver.findElement(By.id("shirt1")).click(); Thread.sleep(1000); driver.findElement(By.id("color")).clear(); driver.findElement(By.id("size")).clear(); driver.findElement(By.id("quantity")).clear(); driver.findElement(By.id("color")).sendKeys("Silver"); driver.findElement(By.id("size")).sendKeys("S"); driver.findElement(By.id("quantity")).sendKeys("2"); driver.findElement(By.id("addToCart")).click(); Thread.sleep(2000); success = true; assertTrue(success); Thread.sleep(2000); }
From source file:co.edu.uniandes.csw.appmarketplace.functionalTest.AppFunctionalIT.java
@Test @RunAsClient/*w w w .j av a 2 s. c o m*/ public void t01GetAppsByKeyWords() throws InterruptedException { boolean success = false; Thread.sleep(3000); driver.findElement(By.id("txtBuscarApp")).clear(); driver.findElement(By.id("txtBuscarApp")).sendKeys(data.get(0).getName()); driver.findElement(By.id("btnBuscar")).click(); Thread.sleep(2000); List<WebElement> apps = driver.findElements(By.xpath("//div[contains(@ng-repeat,'record in records')]")); for (WebElement app : apps) { if (app.getText().contains(data.get(0).getName())) { success = true; } } assertTrue(success); Thread.sleep(1000); }
From source file:co.edu.uniandes.csw.artwork.tests.selenium.pages.artist.ArtistListPage.java
License:Open Source License
private String findNameByIndex(Integer index) { return browser.findElement(By.id(index + "-name")).getText(); }
From source file:co.edu.uniandes.csw.artwork.tests.selenium.pages.artist.ArtistListPage.java
License:Open Source License
private WebElement findDetailsBtnByIndex(Integer index) { By selector = By.id(index + "-detail-btn"); waitGui().until().element(selector).is().visible(); return browser.findElement(selector); }
From source file:co.edu.uniandes.csw.artwork.tests.selenium.pages.artist.ArtistListPage.java
License:Open Source License
private WebElement findEditBtnByIndex(Integer index) { By selector = By.id(index + "-edit-btn"); waitGui().until().element(selector).is().visible(); return browser.findElement(selector); }
From source file:co.edu.uniandes.csw.artwork.tests.selenium.pages.artist.ArtistListPage.java
License:Open Source License
private WebElement findDeleteBtnByIndex(Integer index) { By selector = By.id(index + "-delete-btn"); waitGui().until().element(selector).is().visible(); return browser.findElement(selector); }
From source file:co.edu.uniandes.csw.bookstore.selenium.EditorialIT.java
@Test @InSequence(1)/* ww w . j a v a2s .c o m*/ public void createEditorial(@InitialPage EditorialPage editorialPage) { EditorialDTO editorial = factory.manufacturePojo(EditorialDTO.class); editorialPage.createEditorial(editorial); WebElement name1 = browser.findElement(By.id("0-name")); Assert.assertTrue(name1.isDisplayed()); Assert.assertEquals(editorial.getName(), name1.getText()); }
From source file:co.edu.uniandes.csw.bookstore.selenium.EditorialIT.java
@Test @InSequence(2)//from www. j a v a 2 s .co m public void editFirstEditorial(@InitialPage EditorialPage editorialPage) { EditorialDTO editorial = factory.manufacturePojo(EditorialDTO.class); editorialPage.editFirstEditorial(editorial); WebElement name1 = browser.findElement(By.id("0-name")); Assert.assertTrue(name1.isDisplayed()); Assert.assertEquals(editorial.getName(), name1.getText()); }
From source file:co.edu.uniandes.csw.cliente.web.test.ClienteTest.java
@Test public void testRegistrar() throws Exception { String cadena = "prueba11"; driver.findElement(By.xpath("//button[contains(@id,'button3')]")).click(); Thread.sleep(5000);//w w w.j a v a 2s . c om driver.findElement(By.id("name")).clear(); driver.findElement(By.id("name")).sendKeys(cadena); driver.findElements(By.id("docId")).get(1).clear(); driver.findElements(By.id("docId")).get(1).sendKeys(cadena); driver.findElement(By.id("tipo")).clear(); driver.findElement(By.id("tipo")).sendKeys(cadena); driver.findElements(By.id("password")).get(1).clear(); driver.findElements(By.id("password")).get(1).sendKeys(cadena); driver.findElements(By.xpath("//button[contains(@id,'cliente-loginButton')]")).get(1).click(); Thread.sleep(5000); // List<WebElement> table = driver.findElements(By.xpath("//table[contains(@class,'table striped')]/tbody/tr")); // boolean sucess = false; // for (WebElement webElement : table) // { // List<WebElement> elems = webElement.findElements(By.xpath("td")); // if (elems.get(0).getText().equals("aaa") && elems.get(1).getText().equals("aaa") // && elems.get(2).getText().equals("aaa") && elems.get(2).getText().equals("aaa")) // { // sucess = true; // } // } boolean sucess = false; String texto1 = driver.findElement(By.id("name")).getAttribute("value"); if (texto1.equals(cadena)) { sucess = true; } assertTrue(sucess); sucess = false; String texto2 = driver.findElement(By.id("docId")).getAttribute("value"); if (texto2.equals(cadena)) { sucess = true; } assertTrue(sucess); sucess = false; String texto3 = driver.findElement(By.id("tipo")).getAttribute("value"); if (texto3.equals(cadena)) { sucess = true; } assertTrue(sucess); sucess = false; String texto4 = driver.findElement(By.id("password")).getAttribute("value"); if (texto4.equals(cadena)) { sucess = true; } assertTrue(sucess); }
From source file:co.edu.uniandes.csw.cliente.web.test.ClienteTest.java
@Test public void testLogin() throws Exception { String cadena = "prueba21"; driver.findElement(By.xpath("//button[contains(@id,'button3')]")).click(); Thread.sleep(5000);/*ww w .j a v a2s .co m*/ driver.findElement(By.id("name")).clear(); driver.findElement(By.id("name")).sendKeys(cadena); driver.findElements(By.id("docId")).get(1).clear(); driver.findElements(By.id("docId")).get(1).sendKeys(cadena); driver.findElement(By.id("tipo")).clear(); driver.findElement(By.id("tipo")).sendKeys(cadena); driver.findElements(By.id("password")).get(1).clear(); driver.findElements(By.id("password")).get(1).sendKeys(cadena); driver.findElements(By.xpath("//button[contains(@id,'cliente-loginButton')]")).get(1).click(); Thread.sleep(5000); // List<WebElement> table = driver.findElements(By.xpath("//table[contains(@class,'table striped')]/tbody/tr")); // boolean sucess = false; // for (WebElement webElement : table) // { // List<WebElement> elems = webElement.findElements(By.xpath("td")); // if (elems.get(0).getText().equals("aaa") && elems.get(1).getText().equals("aaa") // && elems.get(2).getText().equals("aaa") && elems.get(2).getText().equals("aaa")) // { // sucess = true; // } // } boolean sucess = false; String texto1 = driver.findElement(By.id("name")).getAttribute("value"); if (texto1.equals(cadena)) { sucess = true; } assertTrue(sucess); sucess = false; String texto2 = driver.findElement(By.id("docId")).getAttribute("value"); if (texto2.equals(cadena)) { sucess = true; } assertTrue(sucess); sucess = false; String texto3 = driver.findElement(By.id("tipo")).getAttribute("value"); if (texto3.equals(cadena)) { sucess = true; } assertTrue(sucess); sucess = false; String texto4 = driver.findElement(By.id("password")).getAttribute("value"); if (texto4.equals(cadena)) { sucess = true; } assertTrue(sucess); driver.findElement(By.xpath("//button[contains(@id,'button7')]")).click(); Thread.sleep(5000); driver.findElement(By.xpath("//button[contains(@id,'button3')]")).click(); Thread.sleep(5000); driver.findElements(By.id("docId")).get(0).clear(); driver.findElements(By.id("docId")).get(0).sendKeys(cadena); driver.findElements(By.id("password")).get(0).clear(); driver.findElements(By.id("password")).get(0).sendKeys(cadena); driver.findElements(By.xpath("//button[contains(@id,'cliente-loginButton')]")).get(0).click(); Thread.sleep(5000); sucess = false; texto1 = driver.findElement(By.id("name")).getAttribute("value"); if (texto1.equals(cadena)) { sucess = true; } assertTrue(sucess); sucess = false; texto2 = driver.findElement(By.id("docId")).getAttribute("value"); if (texto2.equals(cadena)) { sucess = true; } assertTrue(sucess); sucess = false; texto3 = driver.findElement(By.id("tipo")).getAttribute("value"); if (texto3.equals(cadena)) { sucess = true; } assertTrue(sucess); sucess = false; texto4 = driver.findElement(By.id("password")).getAttribute("value"); if (texto4.equals(cadena)) { sucess = true; } assertTrue(sucess); }