List of usage examples for org.openqa.selenium By id
public static By id(String id)
From source file:co.edu.uniandes.csw.stamps.tests.selenium.pages.artist.ArtistListPage.java
License:Open Source License
private String findTelephoneByIndex(Integer index) { return browser.findElement(By.id(index + "-telephone")).getText(); }
From source file:co.edu.uniandes.csw.stamps.tests.selenium.pages.artist.ArtistListPage.java
License:Open Source License
private String findArtisticCareerByIndex(Integer index) { return browser.findElement(By.id(index + "-artisticCareer")).getText(); }
From source file:co.flexmod.selenium.example.integration.HelloWorldPage.java
License:Apache License
public String panelHeader() { WebElement pnlHeader = webDriver.findElement(By.id(PNL_HELLO_WORLD)); return pnlHeader.findElement(By.className("ui-panel-title")).getText(); }
From source file:co.flexmod.selenium.example.integration.HelloWorldPage.java
License:Apache License
public String message() { return webDriver.findElement(By.id(TXT_MESSAGE)).getText(); }
From source file:co.flexmod.selenium.example.integration.HelloWorldPage.java
License:Apache License
public String nameLabel() { return webDriver.findElement(By.id(LBL_NAME)).getText(); }
From source file:co.flexmod.selenium.example.integration.HelloWorldPage.java
License:Apache License
public void setNameValue(String value) { WebElement txtName = webDriver.findElement(By.id(TXT_NAME)); txtName.clear(); txtName.sendKeys(value); }
From source file:co.flexmod.selenium.example.integration.HelloWorldPage.java
License:Apache License
public String getTxtNameValue() { return webDriver.findElement(By.id(TXT_NAME)).getText(); }
From source file:co.flexmod.selenium.example.integration.HelloWorldPage.java
License:Apache License
public void clickButton() { webDriver.findElement(By.id(BTN_SAY_HELLO)).click(); WaitUtil.waitForAjax(webDriver); }
From source file:co.uniandes.csw.ClinicaDeProblemas.test.ComentarioTest.java
@Test public void testCreateEquipo() throws Exception { driver.get(baseUrl + "/ClinicaDeProblemas.web/comentario.html"); // driver.findElement(By.linkText("Proyectos")).click(); /**//from w w w. j a va 2 s . c o m * Comando que realiza click sobre el boton "create" del toolbar. La * funcin 'find' encuentra el control y posteriormente hace clic en el * mismo. La forma en la que se busca el control es utilizando * expresiones xPath ya que los id de los mismos nunca son iguales (se * generan con junto con el valor de componentId que vara). */ driver.findElement(By.xpath("//button[contains(@id,'create')]")).click(); /** * Comando que duerme el Thread del test por 2 segundos para dejar que * el efecto 'slide down' de backbone abra el formulario de createSport. */ Thread.sleep(2000); /** * Comando que busca el elemento 'name' en el html actual. * Posteriormente limpia su contenido (comando clean). */ driver.findElement(By.id("name")).clear(); /** * Comando que simula la escritura de un valor en el elemento(sendKeys) * con el String de parmetro sobre // el elemento encontrado. */ driver.findElement(By.id("name")).sendKeys("coment1"); driver.findElement(By.id("contenido")).clear(); driver.findElement(By.id("contenido")).sendKeys("contenido1"); driver.findElement(By.id("login")).clear(); driver.findElement(By.id("login")).sendKeys("login1"); Thread.sleep(2000); Thread.sleep(2000); Thread.sleep(2000); List<WebElement> a = driver.findElements(By.xpath("//button[contains(@id,'create')]")); a.get(1).click(); Thread.sleep(2000); Thread.sleep(2000); // driver.findElement(By.xpath("//button[contains(@id,'create')]")).click(); List<WebElement> b = driver.findElements(By.id("name")); b.get(1).sendKeys("coment1"); // driver.findElement(By.id("name")).sendKeys("emprendimiento"); Thread.sleep(2000); /** * Comando que encuentra y hace clic sobre el boton "Save" del toolbar * (una vez mas encontrado por una expresin Xpath) */ List<WebElement> c = driver.findElements(By.xpath("//button[contains(@id,'save')]")); c.get(1).click(); c.get(0).click(); /** * Comando que duerme el thread para esperar el efecto de slide down que * abre la lista */ Thread.sleep(2000); /** * Comando que obtiene el div azul de creacin exitosa. Si se obtiene, * la prueba va bien, si no, saldr un error y la prueba quedar como * fllida. */ WebElement dialog = driver.findElement(By.xpath("//div[contains(@style,'display: block;')]")); /** * la prueba es exitosa si se encontr el dialogo de creacin exitosa */ assertTrue(dialog != null); }
From source file:co.uniandes.csw.ClinicaDeProblemas.test.ComentarioTest.java
@Test public void testUpdateSport() throws Exception { driver.get(baseUrl + "/ClinicaDeProblemas.web/comentario.html"); // driver.findElement(By.linkText("Proyectos")).click(); //Se hace clic en el vinculo "Edit" del primer elemento de la lista de sports (el elemento que se cre en la anterior prueba) driver.findElement(By.linkText("Editar")).click(); Thread.sleep(2000);//from www .j av a 2s. c o m //Se realiza el mismo proceso de diligenciamento de los campos con los cambios driver.findElement(By.id("name")).clear(); ; driver.findElement(By.id("name")).sendKeys("coment1"); driver.findElement(By.id("contenido")).clear(); driver.findElement(By.id("contenido")).sendKeys("contenido1"); driver.findElement(By.id("login")).clear(); driver.findElement(By.id("login")).sendKeys("login1"); driver.findElement(By.xpath("//button[contains(@id,'saveButton')]")).click(); Thread.sleep(2000); //Se verifica que en la lista de respuesta hallan aparecido los cambios en el elemento y tambin el mensaje de edicin exitosa. WebElement dialog = driver.findElement(By.xpath("//div[contains(@style,'display: block;')]")); 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("coment1")) { fail = true; } } // driver.findElement(By.linkText("Proyectos")).click(); /** * Comando que realiza click sobre el boton "create" del toolbar. La * funcin 'find' encuentra el control y posteriormente hace clic en el * mismo. La forma en la que se busca el control es utilizando * expresiones xPath ya que los id de los mismos nunca son iguales (se * generan con junto con el valor de componentId que vara). */ driver.findElement(By.xpath("//button[contains(@id,'create')]")).click(); /** * Comando que duerme el Thread del test por 2 segundos para dejar que * el efecto 'slide down' de backbone abra el formulario de createSport. */ Thread.sleep(2000); /** * Comando que busca el elemento 'name' en el html actual. * Posteriormente limpia su contenido (comando clean). */ driver.findElement(By.id("name")).clear(); /** * Comando que simula la escritura de un valor en el elemento(sendKeys) * con el String de parmetro sobre // el elemento encontrado. */ driver.findElement(By.id("name")).sendKeys("coment1"); driver.findElement(By.id("contenido")).clear(); driver.findElement(By.id("contenido")).sendKeys("contenido1"); driver.findElement(By.id("login")).clear(); driver.findElement(By.id("login")).sendKeys("login1"); Thread.sleep(2000); Thread.sleep(2000); Thread.sleep(2000); List<WebElement> a = driver.findElements(By.xpath("//button[contains(@id,'create')]")); a.get(1).click(); Thread.sleep(2000); Thread.sleep(2000); // driver.findElement(By.xpath("//button[contains(@id,'create')]")).click(); List<WebElement> b = driver.findElements(By.id("name")); b.get(1).sendKeys("hola"); // driver.findElement(By.id("name")).sendKeys("emprendimiento"); Thread.sleep(2000); /** * Comando que encuentra y hace clic sobre el boton "Save" del toolbar * (una vez mas encontrado por una expresin Xpath) */ List<WebElement> c = driver.findElements(By.xpath("//button[contains(@id,'save')]")); c.get(1).click(); c.get(0).click(); }