// Method checking if the edited profile is displayed back to the user and if illegal string like
  // URL and email id are stripped off from "profile essay" sections
  private void verifyChanges() {

    List<WebElement> allElements = driver.findElements(By.cssSelector("div[id='about_myself'] p"));
    for (WebElement element1 : allElements) {
      if (element1.getText().contains("www.") || element1.getText().contains(".com")) ;
      ripOffTextAboutMe++;
    }

    List<WebElement> allElements2 =
        driver.findElements(By.cssSelector("div[id='who_im_looking_for'] p"));

    for (WebElement element2 : allElements2) {
      if (element2.getText().contains("www.") || element2.getText().contains(".com")) ;
      ripOffTextPartnerSearch++;
    }

    List<WebElement> allElement3 =
        driver.findElements(By.cssSelector("ul[class='profileInformation'] li"));
    for (WebElement element3 : allElement3) {
      // System.out.println(element3.getText());
      if (element3.getText().contains("Mixed") || element3.getText().contains("4ft. 10in."))
        profileChangeCheck++;
    }

    if (profileChangeCheck > 0)
      System.out.println("SUCCESS: The changes made in the basic profile are visible");

    if (ripOffTextAboutMe != 0)
      System.out.println(
          "SUCCESS: The About Myself section has ripped off any illegal strings like URL and Email id");

    if (ripOffTextPartnerSearch != 0)
      System.out.println(
          "SUCCESS: The What I am Looking For section has ripped off any illegal strings like URL and Email id");
  }
 @Test
 public void testLoginMaster2() throws Exception {
   driver.get(baseUrl + "/login.html");
   driver.findElement(By.name("j_username")).clear();
   driver.findElement(By.name("j_username")).sendKeys("*****@*****.**");
   driver.findElement(By.name("j_password")).clear();
   driver.findElement(By.name("j_password")).sendKeys("master");
   driver.findElement(By.xpath("//input[@value='Login']")).click();
   driver.findElement(By.linkText("Sign out")).click();
 }
 @Test
 public void testBookSearch5() throws Exception {
   driver.get(baseUrl + "/proyectoBiblioteca/");
   new Select(driver.findElement(By.name("type"))).selectByVisibleText("Editorial");
   driver.findElement(By.name("search")).clear();
   driver.findElement(By.name("search")).sendKeys("De Bolsillo");
   driver.findElement(By.xpath("//button[@type='submit']")).click();
   assertEquals(
       "Libros Encontrados", driver.findElement(By.cssSelector("div.panel-heading")).getText());
 }
  @Test
  public void testAbcd() throws Exception {
    driver.get(baseUrl + "/");
    driver.findElement(By.linkText("Sign In")).click();

    driver.findElement(By.linkText("Sign In")).getText();
    driver.findElement(By.xpath("//input[@name='loginName']")).clear();
    driver.findElement(By.xpath("//input[@name='loginName']")).sendKeys("*****@*****.**");
    driver.findElement(By.xpath("//input[@name='password']")).clear();
    driver.findElement(By.xpath("//input[@name='password']")).sendKeys("demo123");
    driver.findElement(By.xpath("//input[@type='image']")).click();
    driver.findElement(By.linkText("Money")).click();

    driver.findElement(By.linkText("Portfolio")).click();
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

    WebElement table = driver.findElement(By.id("table-holding-data"));

    if (table.isDisplayed()) {

      List<WebElement> rows = table.findElements(By.tagName("tr"));

      System.out.println("Row Count - " + rows.size());

      Iterator<WebElement> i = rows.iterator();

      System.out.println("Table has following content");

      while (i.hasNext()) {

        WebElement row = i.next();

        List<WebElement> columns = row.findElements(By.tagName("td"));

        Iterator<WebElement> j = columns.iterator();

        while (j.hasNext()) {

          WebElement column = j.next();

          System.out.print(column.getText());

          System.out.print("    |  ");
        }
        System.out.println("--------------------");
      }
      System.out.println("Table content is printed");
    } else {
      System.out.println("Table not found");
    }
  }
 @Before
 public void setUp() throws Exception {
   driver = new FirefoxDriver();
   baseUrl = "http://bibliotecautn.sytes.net";
   driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
   Utilidades.seleniumLogin(driver, baseUrl);
 }
 // *** Supression des risques de banques
 @Test
 public void testSSV8VALDEBTA997IntegrationTests() throws Exception {
   driver.get(baseUrl + "/selectsystem-view-tomcat-oracle/login.xhtml");
   Thread.sleep(1000);
   findElement(By.id("j_username")).clear();
   findElement(By.id("j_username")).sendKeys("usercenter");
   Thread.sleep(1000);
   findElement(By.id("j_password")).clear();
   findElement(By.id("j_password")).sendKeys("pwd8888");
   findElement(By.cssSelector("#login > img[alt=\"Frensh\"]")).click();
   optionalClick(By.xpath("//span/a"));
   findElement(By.id("form:table:0:sdksds")).click();
   findElement(By.xpath("(//img[@alt='English'])[11]")).click();
   findElement(By.linkText("Managing Risk")).click();
   new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr")))
       .selectByVisibleText("banque test 1");
   Thread.sleep(1000);
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   findElement(By.xpath("//td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr")))
       .selectByVisibleText("banque test 2");
   Thread.sleep(1000);
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   findElement(By.xpath("//td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[2]/a")).click();
   findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[2]/a")).click();
   findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[2]/a")).click();
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr")))
       .selectByVisibleText("banque test 3");
   Thread.sleep(1000);
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   findElement(By.xpath("//td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr")))
       .selectByVisibleText("banque test 2");
   Thread.sleep(1000);
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   findElement(By.xpath("//td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   findElement(By.xpath("(//img[@alt='English'])[2]")).click();
 }
 @Before
 public void setUp() throws Exception {
   driver = new FirefoxDriver();
   baseUrl = "http://in.reuters.com/";
   driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
   driver.manage().window().maximize();
 }
Example #8
0
 private boolean isElementPresent(By by) {
   try {
     driver.findElement(by);
     return true;
   } catch (NoSuchElementException e) {
     return false;
   }
 }
Example #9
0
 private boolean isAlertPresent() {
   try {
     driver.switchTo().alert();
     return true;
   } catch (NoAlertPresentException e) {
     return false;
   }
 }
Example #10
0
 @After
 public void tearDown() throws Exception {
   driver.quit();
   String verificationErrorString = verificationErrors.toString();
   if (!"".equals(verificationErrorString)) {
     fail(verificationErrorString);
   }
 }
Example #11
0
  //  Delete CSR
  @Test
  public void Test5() throws Exception {
    driver.get(baseUrl + "/#/host/magehostmanager.magemojo.com/configuration/ssl");
    driver.findElement(By.xpath("//a[contains(text(),'www.Testing5.com')]")).click();
    assertEquals(
        "Download CSR www.Testing5.com", driver.findElement(By.xpath("//legend[4]")).getText());
    driver.findElement(By.xpath("(//button[@type='button'])[8]")).click();
    assertEquals(
        "Confirmation Window",
        driver.findElement(By.cssSelector("h3.modal-title.ng-binding")).getText());
    assertTrue(isElementPresent(By.xpath("//div[3]/button[2]")));
    driver.findElement(By.xpath("//div[3]/button")).click();

    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if ("Successfully deleted the CSR."
            .equals(driver.findElement(By.xpath("//div[@id='toast-container']/div")).getText()))
          break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }

    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if (!isElementPresent(By.xpath("//a[contains(text(),'www.Testing5.com')]"))) break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }
  }
 @Before
 public void setUp() throws Exception {
   driver = new FirefoxDriver();
   recorder = new Recorder();
   baseUrl = "http://10.0.0.107:8080/";
   driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
   driver.manage().window().maximize();
   recorder.startRecording(this.getClass().getName());
 }
Example #13
0
  @Test
  public void testWeather() throws Exception {
    driver.get(baseUrl + "/");
    driver.findElement(By.linkText("Edmonton")).click();
    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if (isElementPresent(By.id("cityjump"))) break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }

    // Warning: verifyTextPresent may require manual changes
    try {
      assertTrue(
          driver
              .findElement(By.cssSelector("BODY"))
              .getText()
              .matches("^[\\s\\S]*Current Conditions[\\s\\S]*$"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
    // Warning: verifyTextPresent may require manual changes
    try {
      assertTrue(
          driver
              .findElement(By.cssSelector("BODY"))
              .getText()
              .matches("^[\\s\\S]*Forecast[\\s\\S]*$"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
    // Warning: verifyTextPresent may require manual changes
    try {
      assertTrue(
          driver
              .findElement(By.cssSelector("BODY"))
              .getText()
              .matches("^[\\s\\S]*Edmonton City Centre Airport[\\s\\S]*$"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
  }
 // *** l'utilisation des données "......"
 // ** et des données de longeurs de "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"
 // pour le champ nom
 // * l'impossibilité de modifier l'id d'un motif de remplacemnt une fois enregistré
 @Test
 public void testSSV8VALDEBTA008cIntegrationTests() throws Exception {
   driver.get(baseUrl + "/selectsystem-view-tomcat-oracle/login.xhtml");
   Thread.sleep(1000);
   findElement(By.id("j_username")).clear();
   findElement(By.id("j_username")).sendKeys("usercenter");
   Thread.sleep(1000);
   findElement(By.id("j_password")).clear();
   findElement(By.id("j_password")).sendKeys("pwd8888");
   findElement(By.cssSelector("#login > img[alt=\"Frensh\"]")).click();
   optionalClick(By.xpath("//span/a"));
   findElement(By.id("form:table:1:sdksds")).click();
   findElement(By.xpath("(//img[@alt='English'])[4]")).click();
   findElement(By.xpath("(//a[contains(text(),'Card Replacement Motif')])[2]")).click();
   new Select(findElement(By.id("globalCardReplacementMotifForm:bank")))
       .selectByVisibleText("banque test 3");
   Thread.sleep(1000);
   findElement(By.xpath("//table[@id='globalCardReplacementMotifForm:AZ']/tbody/tr/td/a[3]/img"))
       .click();
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys("..........");
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).sendKeys("ReasRp_031");
   findElement(By.cssSelector("img[alt=\"save2\"]")).click();
   findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click();
   findElement(By.xpath("//table[@id='globalCardReplacementMotifForm:AZ']/tbody/tr/td/a[3]/img"))
       .click();
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys("ReasRp_031");
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee"))
       .sendKeys("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
   findElement(By.cssSelector("img[alt=\"save2\"]")).click();
   findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click();
   findElement(By.xpath("//table[@id='globalCardReplacementMotifForm:AZ']/tbody/tr/td/a[3]/img"))
       .click();
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys("ReasRp_033");
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).sendKeys("ReasRp_033");
   findElement(By.cssSelector("img[alt=\"save2\"]")).click();
   findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click();
   findElement(
           By.id(
               "globalCardReplacementMotifForm:searchCardDesignFeesResultsId:0:scxqsjhvcqjshcvhqsceee"))
       .click();
   findElement(By.cssSelector("img[alt=\"save2\"]")).click();
   findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click();
   findElement(By.xpath("(//img[@alt='English'])[2]")).click();
 }
 private WebElement findElement(final By locator) {
   (new WebDriverWait(driver, 30, 1000))
       .until(ExpectedConditions.presenceOfElementLocated(locator));
   (new WebDriverWait(driver, 30, 1000))
       .until(ExpectedConditions.visibilityOfElementLocated(locator));
   WebElement element = driver.findElement(locator);
   if (element.isEnabled() == false)
     ((JavascriptExecutor) driver).executeScript("arguments[0].disabled = false", element);
   return element;
 }
Example #16
0
  @Test
  public void testClientOptions() throws Exception {
    driver.get(baseUrl + "/login");

    driver.findElement(By.id("inputEmail")).clear();
    driver.findElement(By.id("inputEmail")).sendKeys("*****@*****.**");
    driver.findElement(By.id("inputPassword")).clear();
    driver.findElement(By.id("inputPassword")).sendKeys("qwerty");
    driver.findElement(By.xpath("//button")).click();
    driver.findElement(By.id("blockButton")).click();
    driver.findElement(By.xpath("//p[3]/button")).click();
    driver.findElement(By.xpath("//button[3]")).click();
    driver.findElement(By.id("blockButton")).click();
    driver.findElement(By.xpath("//p[3]/button")).click();
    driver.findElement(By.id("discard")).click();
  }
  public void optionalClick(final By locator) {
    WebElement we = null;
    try {
      we = driver.findElement(locator);
      we.click();
    } catch (StaleElementReferenceException ser) {

    } catch (NoSuchElementException nse) {

    } catch (Exception e) {
      // staticlogger.info( e.getMessage() );
    }
  }
Example #18
0
  @Test
  public void testOtsi() throws Exception {
    driver.get(baseUrl + "/");
    driver.findElement(By.linkText("Kandidaadid")).click();
    // Warning: waitForTextPresent may require manual changes
    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if (driver
            .findElement(By.cssSelector("BODY"))
            .getText()
            .matches("^[\\s\\S]*Vana Kala[\\s\\S]*$")) break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }

    driver.findElement(By.id("nimi")).clear();
    driver.findElement(By.id("nimi")).sendKeys("Magdalena");
    try {
      assertEquals("Magdalena", driver.findElement(By.id("nimi")).getAttribute("value"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
    driver.findElement(By.id("sButton")).click();
    // Warning: waitForTextPresent may require manual changes
    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if (driver
            .findElement(By.cssSelector("BODY"))
            .getText()
            .matches("^[\\s\\S]*Magdalena Malejeva[\\s\\S]*$")) break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }

    // Warning: verifyTextNotPresent may require manual changes
    try {
      assertFalse(
          driver
              .findElement(By.cssSelector("BODY"))
              .getText()
              .matches("^[\\s\\S]*Vana Kala[\\s\\S]*$"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
  }
 @Test
 public void testContactAdd() throws Exception {
   driver.get(LoginHelper.baseUrl + "/Account/Login?ReturnUrl=%2f");
   LoginHelper.login(driver);
   try {
     Thread.sleep(2000);
   } catch (InterruptedException x) {
   }
   driver.findElement(By.id("tileContactModule")).click();
   driver.findElement(By.linkText("Добавить новый")).click();
   driver.findElement(By.id("FirstName")).click();
   driver.findElement(By.id("FirstName")).clear();
   driver.findElement(By.id("FirstName")).sendKeys("AutoName");
   driver.findElement(By.id("LastName")).click();
   driver.findElement(By.id("LastName")).clear();
   driver.findElement(By.id("LastName")).sendKeys("Auto2Name");
   new Select(driver.findElement(By.id("SpecialityId"))).selectByVisibleText("Chirurg");
   driver.findElement(By.id("bntSave")).click();
 }
Example #20
0
 @Test
 public void testIncorrectIncorrect() throws Exception {
   driver.get(baseUrl + "/");
   driver.findElement(By.linkText("Log In")).click();
   driver.findElement(By.id("navbar_username")).clear();
   driver.findElement(By.id("navbar_username")).sendKeys("wrong");
   driver.findElement(By.id("navbar_password")).clear();
   driver.findElement(By.id("navbar_password")).sendKeys("wrong");
   driver.findElement(By.cssSelector("input.button")).click();
   assertEquals("Log In", driver.findElement(By.linkText("Log In")).getText());
   driver.findElement(By.cssSelector("img[alt=\"Myth-Weavers\"]")).click();
 }
Example #21
0
 private String closeAlertAndGetItsText() {
   try {
     Alert alert = driver.switchTo().alert();
     String alertText = alert.getText();
     if (acceptNextAlert) {
       alert.accept();
     } else {
       alert.dismiss();
     }
     return alertText;
   } finally {
     acceptNextAlert = true;
   }
 }
 @Test
 public void testRegistreerimine() throws Exception {
   driver.get(baseUrl + "/login");
   driver.findElement(By.xpath("//button[5]")).click();
   driver.findElement(By.id("kasutajanimi")).clear();
   driver.findElement(By.id("kasutajanimi")).sendKeys("Testkasutaja");
   driver.findElement(By.id("eesnimi")).clear();
   driver.findElement(By.id("eesnimi")).sendKeys("Test");
   driver.findElement(By.id("perenimi")).clear();
   driver.findElement(By.id("perenimi")).sendKeys("Kasutaja");
   driver.findElement(By.id("parool")).clear();
   driver.findElement(By.id("parool")).sendKeys("testkasutaja");
   driver.findElement(By.id("email")).clear();
   driver.findElement(By.id("email")).sendKeys("*****@*****.**");
   driver.findElement(By.id("telnr")).clear();
   driver.findElement(By.id("telnr")).sendKeys("55123123");
   driver.findElement(By.id("regamisnupp")).click();
   try {
     assertEquals(
         "Registreerimine õnnestus!", driver.findElement(By.xpath("//div/div/div/div")).getText());
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
 }
Example #23
0
 @Test
 public void testScenario4() throws Exception {
   driver.get(baseUrl + "/recipe/index.php");
   driver.findElement(By.xpath("//div[@id='nav']/table/tbody/tr[7]/td/a/strong")).click();
   driver.findElement(By.name("title")).clear();
   driver.findElement(By.name("title")).sendKeys("Chicken Ramen");
   driver.findElement(By.name("shortdesc")).clear();
   driver.findElement(By.name("shortdesc")).sendKeys("Classic Ramen noodles");
   driver.findElement(By.name("ingredients")).clear();
   driver.findElement(By.name("ingredients")).sendKeys("Ramen package, 2 cups water");
   driver.findElement(By.name("directions")).clear();
   driver
       .findElement(By.name("directions"))
       .sendKeys(
           "Bring water to boil. Add noodles from package. Boil 7 minutes. Add flavor package.");
   driver.findElement(By.cssSelector("#main > form > input[type=\"submit\"]")).click();
   // Warning: assertTextPresent may require manual changes
   assertTrue(
       driver
           .findElement(By.cssSelector("BODY"))
           .getText()
           .matches("^[\\s\\S]*Recipe posted[\\s\\S]*$"));
 }
  @Test
  public void testSetUp() throws Exception {

    driver.get(baseUrl + "/");
    int TestCase = 2; // Flip the TestCase numbers to run a particular test case at a time
    switch (TestCase) {
      case 1:
        // Invoking Test Case 1:
        newProfilePostalCodeEmpty();
        break;
      case 2:
        // Invoking Test Case 2:
        profileSetUpNicknameEmpty();
        break;
      case 3:
        // Invoking Test Case 3:
        profileSetUpEmailIllegal();
        break;
      case 4:
        // Invoking Test Case 4;
        profileSetUpEmailAlpha();
        break;
      case 5:
        // Invoking Test Case 5:
        profileSetUpEmailEmpty();
        break;

      case 6:
        // Invoking Test Case 6:
        profileSetUpPasswordEmpty();
        break;

      case 7:
        // Invoking Test Case 7:
        profileSetUpCorrect();
        break;

      case 8:
        // Invoking Test Case 8:
        profileEditViewSetUp();
        break;
    }
  }
Example #25
0
  @Before
  public void setUp() throws Exception {
    prop = new Properties();

    try {
      prop.load(new FileInputStream(new java.io.File("").getAbsolutePath() + "/era.properties"));
      gridHost = prop.getProperty("grid.host");
      gridPort = prop.getProperty("grid.port");

    } catch (Exception e) {
      gridHost = "http://localhost";
      gridPort = "4444";
    }

    DesiredCapabilities capability = DesiredCapabilities.firefox();
    driver = new RemoteWebDriver(new URL(gridHost + ":" + gridPort + "//wd/hub"), capability);
    baseUrl = "http://weather.gc.ca/";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
  }
 @Test
 public void testAltaDePrestamo1() throws Exception {
   driver.get(
       baseUrl
           + "/proyectoBiblioteca/Prestamos?action=new&id=1"); // El 1 es el id del ejemplar, debe
                                                               // estar disponible para que
                                                               // funcione la prueba
   new Select(driver.findElement(By.name("prestamoLocal"))).selectByVisibleText("No");
   driver.findElement(By.name("idSocio")).clear();
   driver.findElement(By.name("idSocio")).sendKeys("5"); // id de gonza, está inhabilitado
   driver.findElement(By.id("fecha")).clear();
   driver
       .findElement(By.id("fecha"))
       .sendKeys(Utilidades.getSimpleDate(new Date())); // pongo la fecha de hoy
   driver.findElement(By.cssSelector("button.btn.btn-success")).click();
   assertEquals(
       "Préstamo no creado. El socio ingresado no se encuentra habilitado para recibir préstamos.",
       driver.findElement(By.cssSelector("div.alert.alert-info")).getText());
 }
Example #27
0
File: LFT.java Project: qarocks/SPW
  @Before
  public void setUp() throws Exception {

    // System.setProperty("webdriver.chrome.driver","C:\\Users\\Sneha\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe");
    System.setProperty("webdriver.firefox.bin", "C:\\Mozilla Firefox\\firefox.exe");

    /*File profileDir = new File("C:\\Users\\Sneha\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\hl4nsrj3.no silveright");
        FirefoxProfile profile = new FirefoxProfile(profileDir);
        profile.setPreference("general.useragent.override", "same user agent string as above");


    driver = new FirefoxDriver(profile);
    */
    driver = new FirefoxDriver();
    // driver=new ChromeDriver();

    // WebDriver driver = new InternetExplorerDriver();

    driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
    selenium = new WebDriverBackedSelenium(driver, baseUrl);

    webDriver = new HtmlUnitDriver(true);
  }
Example #28
0
 @Test
 public void testEditProfile() throws Exception {
   driver.get(baseUrl + "/");
   driver.findElement(By.xpath("(//a[contains(text(),'log in')])[2]")).click();
   driver.findElement(By.xpath("(//a[contains(text(),'log in')])[2]")).click();
   driver.findElement(By.id("email")).click();
   driver.findElement(By.id("email")).clear();
   driver.findElement(By.id("email")).sendKeys("*****@*****.**");
   driver.findElement(By.id("password")).clear();
   driver.findElement(By.id("password")).sendKeys("Eliandtyler1");
   driver.findElement(By.id("submit-button")).click();
   driver.findElement(By.id("submit-button")).click();
   driver.findElement(By.cssSelector("img.avatar-me.js-avatar-me")).click();
   driver.findElement(By.cssSelector("img.avatar-me.js-avatar-me")).click();
   driver.findElement(By.linkText("Edit Profile & Settings")).click();
   driver.findElement(By.linkText("Edit Profile & Settings")).click();
   // Warning: assertTextPresent may require manual changes
   assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$"));
   // Warning: assertTextPresent may require manual changes
   assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$"));
   // Warning: assertTextPresent may require manual changes
   assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$"));
   // Warning: assertTextPresent may require manual changes
   assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$"));
   // Warning: assertTextPresent may require manual changes
   assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*$"));
 }
Example #29
0
 @Before
 public void setUp() throws Exception {
   driver = new FirefoxDriver();
   baseUrl = "https://stackoverflow.com/";
   driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
 }
 @Test
 public void testAddCampaign() throws Exception {
   driver.get(baseUrl + "/");
   driver.findElement(By.id("username")).clear();
   driver.findElement(By.id("username")).sendKeys("test");
   driver.findElement(By.id("password")).clear();
   driver.findElement(By.id("password")).sendKeys("test");
   driver.findElement(By.cssSelector("button.btn.btn-default")).click();
   driver.findElement(By.linkText("Campaigns")).click();
   driver.findElement(By.cssSelector("button.btn.btn-default")).click();
   driver.findElement(By.xpath("(//button[@type='button'])[2]")).click();
   driver.findElement(By.cssSelector("div.input-group > input.form-control")).clear();
   driver.findElement(By.cssSelector("div.input-group > input.form-control")).sendKeys("test2");
   driver.findElement(By.cssSelector("span.input-group-btn > button.btn.btn-default")).click();
   new Select(driver.findElement(By.cssSelector("select.form-control")))
       .selectByVisibleText("test2");
   driver.findElement(By.xpath("//button[@type='button']")).click();
 }