Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Modulos;
- import java.util.regex.Pattern;
- import java.util.concurrent.TimeUnit;
- import org.junit.*;
- import static org.junit.Assert.*;
- import static org.hamcrest.CoreMatchers.*;
- import org.openqa.selenium.*;
- import org.openqa.selenium.firefox.FirefoxDriver;
- import org.openqa.selenium.support.ui.Select;
- public class Preguntas {
- private WebDriver driver;
- private String baseUrl;
- private boolean acceptNextAlert = true;
- private StringBuffer verificationErrors = new StringBuffer();
- @Before
- public void setUp() throws Exception {
- driver = new FirefoxDriver();
- baseUrl = "http://srvd-sp1:45002/Paginas/PreguntasFrecuentes.aspx";
- driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
- }
- @Test
- public void testCrearPregunta() throws Exception {
- driver.get(baseUrl + "/Paginas/PreguntasFrecuentes.aspx");
- driver.findElement(By.cssSelector("a.LinkPrimario > div")).click();
- new Select(driver.findElement(By.id("exampleSelect1"))).selectByVisibleText("Tema 2");
- driver.findElement(By.id("exampleTextarea")).clear();
- driver.findElement(By.id("exampleTextarea")).sendKeys("Cuánto dinero debo pagar en Selenium?");
- driver.findElement(By.xpath("(//button[@type='button'])[6]")).click();
- driver.findElement(By.cssSelector("button.btn.btn-default")).click();
- }
- @After
- public void tearDown() throws Exception {
- driver.quit();
- String verificationErrorString = verificationErrors.toString();
- if (!"".equals(verificationErrorString)) {
- fail(verificationErrorString);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement