Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. package Modulos;
  2.  
  3. import java.util.regex.Pattern;
  4. import java.util.concurrent.TimeUnit;
  5. import org.junit.*;
  6. import static org.junit.Assert.*;
  7. import static org.hamcrest.CoreMatchers.*;
  8. import org.openqa.selenium.*;
  9. import org.openqa.selenium.firefox.FirefoxDriver;
  10. import org.openqa.selenium.support.ui.Select;
  11.  
  12. public class Preguntas {
  13. private WebDriver driver;
  14. private String baseUrl;
  15. private boolean acceptNextAlert = true;
  16. private StringBuffer verificationErrors = new StringBuffer();
  17.  
  18. @Before
  19. public void setUp() throws Exception {
  20. driver = new FirefoxDriver();
  21. baseUrl = "http://srvd-sp1:45002/Paginas/PreguntasFrecuentes.aspx";
  22. driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
  23. }
  24.  
  25. @Test
  26. public void testCrearPregunta() throws Exception {
  27. driver.get(baseUrl + "/Paginas/PreguntasFrecuentes.aspx");
  28. driver.findElement(By.cssSelector("a.LinkPrimario > div")).click();
  29. new Select(driver.findElement(By.id("exampleSelect1"))).selectByVisibleText("Tema 2");
  30. driver.findElement(By.id("exampleTextarea")).clear();
  31. driver.findElement(By.id("exampleTextarea")).sendKeys("Cuánto dinero debo pagar en Selenium?");
  32. driver.findElement(By.xpath("(//button[@type='button'])[6]")).click();
  33. driver.findElement(By.cssSelector("button.btn.btn-default")).click();
  34. }
  35.  
  36. @After
  37. public void tearDown() throws Exception {
  38. driver.quit();
  39. String verificationErrorString = verificationErrors.toString();
  40. if (!"".equals(verificationErrorString)) {
  41. fail(verificationErrorString);
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement