Created
February 11, 2012 21:53
-
-
Save mauricioaniche/1804470 to your computer and use it in GitHub Desktop.
Exemplo simples com Seleium
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package exercicio.selenium; | |
import static junit.framework.Assert.assertTrue; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.openqa.selenium.By; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.WebDriverBackedSelenium; | |
import org.openqa.selenium.firefox.FirefoxDriver; | |
public class ProdutoSystemTest { | |
private WebDriver browser; | |
private WebDriverBackedSelenium selenium; | |
@Before | |
public void setUp(){ | |
browser = new FirefoxDriver(); | |
selenium = new WebDriverBackedSelenium(browser, ""); | |
} | |
@Test | |
public void deveAdicionarUmProduto() { | |
browser.get("http://localhost:8080/produtos"); | |
browser.findElement(By.linkText("New Produto")).click(); | |
browser.findElement(By.name("produto.nome")).sendKeys("CD da Ivete"); | |
browser.findElement(By.name("produto.descricao")).sendKeys("Cantora baiana"); | |
browser.findElement(By.name("produto.valor")).sendKeys("35.8"); | |
browser.findElement(By.tagName("button")).click(); | |
assertTrue(selenium.isTextPresent("CD da Ivete")); | |
assertTrue(selenium.isTextPresent("Cantora baiana")); | |
assertTrue(selenium.isTextPresent("35.8")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment