コード例 #1
0
 private void SpecialNeeds() throws IOException {
   // Click Special Needs
   driver
       .findElement(
           By.xpath(
               "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Special Needs\")]"))
       .click();
   // Select Special Needs
   Select SpecialNeeds = new Select(driver.findElement(By.id("edit-special-needs")));
   // Select Learning Center
   SpecialNeeds.selectByVisibleText("Learning Center");
   // Select Early Syllabus
   SpecialNeeds.selectByVisibleText("Early syllabus");
   // Click Apply
   driver.findElement(By.id("edit-special-needs-apply-filter")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
コード例 #2
0
 @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();
 }
コード例 #3
0
 @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());
 }
コード例 #4
0
 @Test
 public void testMyFirstWebDriver() throws Exception {
   driver.get(baseUrl + "/HotelApp/");
   driver.findElement(By.linkText("New User Register Here")).isDisplayed();
   driver.findElement(By.xpath(".//*[@id='username']")).clear();
   driver.findElement(By.xpath(".//*[@id='username']")).sendKeys("");
   driver.findElement(By.id("password")).clear();
   driver.findElement(By.id("password")).sendKeys("");
   driver.findElement(By.id("login")).click();
   //   actualText = driver.findElement(By.id("username_span")).getText();
   actualText = driver.findElement(By.cssSelector(".login_error")).getText();
   assertEquals(expectedText, actualText);
 }
コード例 #5
0
 private void TypesOfSchool() throws IOException {
   // Click Type of School
   driver.findElement(By.cssSelector("strong")).click();
   // Click Private
   driver.findElement(By.id("edit-public-private-private")).click();
   // Move School Size Slider
   // TODO Slider not working properly
   WebElement Slider1 = driver.findElement(By.id("population_jq_slider"));
   Actions moveSlider1 = new Actions(driver);
   Action action1 = moveSlider1.dragAndDropBy(Slider1, 0, 10).build();
   action1.perform();
   // Select Religious Affiliation
   new Select(driver.findElement(By.id("edit-religious-affiliation")))
       .selectByVisibleText("Church of Christ");
   // Move Tuition Range Slider
   // TODO Slider not working properly
   WebElement Slider2 = driver.findElement(By.id("tuition_range_jq_slider"));
   Actions moveSlider2 = new Actions(driver);
   Action action2 = moveSlider2.dragAndDropBy(Slider2, 0, 10).build();
   action2.perform();
   // Click Apply
   driver.findElement(By.id("edit-type-of-school-apply-filter")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
コード例 #6
0
 private void SearchButton() throws IOException {
   // Enter Text To Be Search
   driver.findElement(By.id("edit-keys")).clear();
   driver.findElement(By.id("edit-keys")).sendKeys("Abilene");
   // Click Search
   driver.findElement(By.id("edit-submit")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
コード例 #7
0
ファイル: New4.java プロジェクト: TKosmacki/CS1632
 private boolean isElementPresent(By by) {
   try {
     driver.findElement(by);
     return true;
   } catch (NoSuchElementException e) {
     return false;
   }
 }
コード例 #8
0
 @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();
 }
コード例 #9
0
ファイル: WeatherTest.java プロジェクト: ualbertalib/era-test
  @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());
    }
  }
コード例 #10
0
 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;
 }
  @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");
    }
  }
コード例 #12
0
 private void Location() throws IOException {
   // Click Location
   driver
       .findElement(
           By.xpath(
               "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Location\")]"))
       .click();
   // Click West Checkbox
   // TODO Do not use number in Locator
   driver.findElement(By.xpath("//fieldset[6]/div/div[4]/div/div[3]/input")).click();
   // Click South Checkbox
   // TODO Do not use number in Locator
   driver.findElement(By.xpath("//fieldset[6]/div/div[4]/div/div[6]/input")).click();
   // Click Apply
   driver.findElement(By.id("edit-location-apply-filter")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
コード例 #13
0
 private void ActivitiesOfInterest() throws IOException {
   // Click Activities of Interest
   driver
       .findElement(
           By.xpath(
               "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Activities of Interest\")]"))
       .click();
   // Click Student Newspaper Checkbox
   // TODO Do not use number in locator
   driver.findElement(By.xpath("//div[11]/input")).click();
   // Click TV Station Checkbox
   // TODO Do not use number in locator
   driver.findElement(By.xpath("//div[13]/input")).click();
   // Click Apply
   driver.findElement(By.id("edit-activities-interests-apply-filter")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
コード例 #14
0
ファイル: Test5 - копия.java プロジェクト: Dmitro13/Test
  //  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);
    }
  }
コード例 #15
0
 private void AreaOfStudy() throws IOException, InterruptedException {
   // Click Area of School
   driver
       .findElement(
           By.xpath(
               "//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Area of Study\")]"))
       .click();
   // Select One Area Study
   new Select(driver.findElement(By.id("edit-area-of-study-parent")))
       .selectByVisibleText("Area, Ethnic, Cultural, and Gender Studies");
   // Wait For Another Select List To Load
   Thread.sleep(5000);
   // Select Subareas of Study
   new Select(driver.findElement(By.xpath("//div[@id='child-area-of-study-wrapper']//select")))
       .selectByVisibleText("Area, Ethnic, Cultural, and Gender Studies, Other");
   // Click Apply
   driver.findElement(By.id("edit-area-of-study-apply-filter")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
コード例 #16
0
  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() );
    }
  }
コード例 #17
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();
  }
コード例 #18
0
  @Test
  public void test35() throws Exception {

    driver.get(baseUrl + "/accountType/list");

    driver.findElement(By.xpath("//strong[text()='Direct Customer']")).click();

    driver.findElement(By.cssSelector("a.submit.edit > span")).click();
    driver.findElement(By.id("creditLimitAsDecimal")).clear();
    driver.findElement(By.id("creditLimitAsDecimal")).sendKeys("300.00");
    driver.findElement(By.cssSelector("a.submit.save > span")).click();
    driver.findElement(By.xpath("//strong[text()='Direct Customer']")).click();
    driver.findElement(By.cssSelector("a.submit.edit > span")).click();
    driver.findElement(By.id("creditLimitAsDecimal")).clear();
    driver.findElement(By.id("creditLimitAsDecimal")).sendKeys("200.00");
    driver.findElement(By.cssSelector("a.submit.save > span")).click();
    driver.findElement(By.xpath("//strong[text()='Direct Customer']")).click();

    Assert.assertEquals(driver.getPageSource().contains("US$200.00"), true);
  }
コード例 #19
0
 private void Sports() throws IOException {
   // Click Sports
   driver
       .findElement(
           By.xpath("//ul[@class='vertical-tabs-list']/li/a/strong[contains(text(), \"Sports\")]"))
       .click();
   // Select Sports
   Select Sports = new Select(driver.findElement(By.id("edit-varsity-sports")));
   // Select Baseball
   Sports.selectByVisibleText("baseball");
   // Select Basketball
   Sports.selectByVisibleText("basketball");
   // Click Apply
   driver.findElement(By.id("edit-varsity-sports-apply-filter")).click();
   // Check Result Received or Not
   try {
     assertTrue(
         func.isTextPresent(driver.findElement(By.className("search-total-results")).getText()));
   } catch (Error e) {
     verificationErrors.append(e.toString());
   }
   // Click All Selections
   driver.findElement(By.linkText("Clear All Selections")).click();
 }
コード例 #20
0
ファイル: otsi.java プロジェクト: kristianhunt/Seleniumtest
  @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());
    }
  }
コード例 #21
0
 @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();
 }
コード例 #22
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();
 }
コード例 #23
0
 @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());
   }
 }
コード例 #24
0
ファイル: scenario4.java プロジェクト: kudrix/1699
 @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]*$"));
 }
コード例 #25
0
 @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());
 }
コード例 #26
0
ファイル: Goal.java プロジェクト: casputman/Module2
 @Test
 public void testGoal() throws Exception {
   driver.get(baseUrl + "/ubercoaching/logout");
   driver.findElement(By.linkText("Login")).click();
   driver.findElement(By.name("username")).clear();
   driver.findElement(By.name("username")).sendKeys("test");
   driver.findElement(By.name("password")).clear();
   driver.findElement(By.name("password")).sendKeys("test");
   driver.findElement(By.name("commit")).click();
   driver.findElement(By.xpath("(//a[contains(text(),'PROCEED »')])[4]")).click();
   driver.findElement(By.name("weight")).clear();
   driver.findElement(By.name("weight")).sendKeys("75");
   driver.findElement(By.name("width")).clear();
   driver.findElement(By.name("width")).sendKeys("60");
   driver.findElement(By.cssSelector("input[type=\"submit\"]")).click();
   driver.findElement(By.name("goalWeight")).clear();
   driver.findElement(By.name("goalWeight")).sendKeys("70");
   driver.findElement(By.name("goalDate")).clear();
   driver.findElement(By.name("goalDate")).sendKeys("20/05/2016");
   driver.findElement(By.xpath("//input[@value='Set Goal']")).click();
 }
コード例 #27
0
ファイル: New4.java プロジェクト: TKosmacki/CS1632
 @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]*$"));
 }
コード例 #28
0
  @Test
  public void testMap2() throws Exception {
    driver.get(baseUrl + "/ModSolarPlatform/login.jsp;jsessionid=F33B6C551CBA0A359E87354993539EFA");
    driver.findElement(By.id("username")).clear();
    driver.findElement(By.id("username")).sendKeys("christianqa");
    driver.findElement(By.id("password")).clear();

    driver.findElement(By.id("password")).sendKeys("qa");
    driver.findElement(By.name("submit")).click();
    driver.findElement(By.cssSelector("div.newLeadList")).click();
    driver.findElement(By.id("tabResidential")).click();
    driver.findElement(By.id("firstNameResidential")).clear();
    driver.findElement(By.id("firstNameResidential")).sendKeys("christian");
    driver.findElement(By.id("lastNameResidential")).clear();
    driver.findElement(By.id("lastNameResidential")).sendKeys("Mabila");
    driver.findElement(By.id("addressResidential")).clear();
    driver.findElement(By.id("addressResidential")).sendKeys("600 Clipper rd");
    driver.findElement(By.id("cityResidential")).clear();
    driver.findElement(By.id("cityResidential")).sendKeys("Belmont");
    new Select(driver.findElement(By.id("stateResidential"))).selectByVisibleText("California");
    // driver.findElement(By.id("zipCodeResidential")).clear();
    // driver.findElement(By.id("zipCodeResidential")).sendKeys("90042");
    driver.findElement(By.cssSelector("#zipCodeResidential")).clear();
    driver.findElement(By.cssSelector("#zipCodeResidential")).sendKeys("90042");
    Thread.sleep(1500);
    driver.findElement(By.id("emailResidential")).clear();
    driver.findElement(By.id("emailResidential")).sendKeys("*****@*****.**");
    driver.findElement(By.id("utilityTaxRateInputAddressResidential")).clear();
    driver.findElement(By.id("utilityTaxRateInputAddressResidential")).sendKeys("1.2");
    driver.findElement(By.id("averageMonthlyBillResidential")).clear();
    driver.findElement(By.id("averageMonthlyBillResidential")).sendKeys("225");
    driver.findElement(By.id("nextBtn")).click();
    Thread.sleep(1000);

    WebElement mainCanvas = driver.findElement(By.xpath(".//*[@id='mapCanvas']/div/div[1]/div[2]"));

    Actions mouseAction = new Actions(driver);

    mouseAction.moveToElement(mainCanvas);

    mouseAction.contextClick(mainCanvas);

    mouseAction.moveByOffset(5, 25);

    mouseAction.sendKeys(Keys.ARROW_DOWN);

    mouseAction.sendKeys(Keys.RETURN);
    // mouseAction.keyDown(Keys.ARROW_DOWN);
    // mouseAction.moveToElement(subMenu);

    mouseAction.click();

    mouseAction.perform();

    WebElement mainCanvas2 =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    Actions mouseAction2 = new Actions(driver);

    mouseAction2.moveToElement(mainCanvas2);

    mouseAction2.contextClick(mainCanvas2);

    mouseAction2.moveByOffset(70, 50);

    mouseAction2.sendKeys(Keys.ARROW_DOWN);

    mouseAction2.sendKeys(Keys.RETURN);
    // mouseAction.keyDown(Keys.ARROW_DOWN);
    // mouseAction.moveToElement(subMenu);

    mouseAction2.click();

    mouseAction2.perform();

    WebElement mainCanvas3 =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    Actions mouseAction3 = new Actions(driver);

    mouseAction3.moveToElement(mainCanvas3);

    mouseAction3.contextClick(mainCanvas3);

    mouseAction3.moveToElement(mainCanvas2, 500, 220);

    mouseAction3.sendKeys(Keys.ARROW_DOWN);

    mouseAction3.sendKeys(Keys.RETURN);
    // mouseAction.keyDown(Keys.ARROW_DOWN);
    // mouseAction.moveToElement(subMenu);

    mouseAction3.click();

    mouseAction3.perform();

    // Clicking inside the Triangle

    WebElement e =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    new Actions(driver).moveToElement(e, 0, 0).moveByOffset(520, 255).click().build().perform();
    driver.findElement(By.cssSelector("div.pgNext.right > input.btn")).click();
    driver.findElement(By.xpath("//div[@id='accordion']")).click();
    driver.findElement(By.id("regionsPaneTitle")).click();

    // Clicking inside the Triangle 1

    WebElement eI =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    new Actions(driver).moveToElement(eI, 0, 0).moveByOffset(520, 255).click().build().perform();

    Thread.sleep(1000);

    // Clicking inside the Triangle 1

    WebElement eS =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    new Actions(driver).moveToElement(eS, 0, 0).moveByOffset(520, 255).click().build().perform();
    Thread.sleep(1000);
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Ground Mount");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"2\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Sloped Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"0\"]")).click();
    ////
    // driver.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")).click();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .clear();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .sendKeys("52");
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .click();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .clear();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .sendKeys("18");
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .click();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .clear();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .sendKeys("45");
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Sloped Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"0\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();

    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Ground Mount");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"2\"]")).click();
    driver.findElement(By.cssSelector("label.overTxtLabel")).click();
    driver.findElement(By.id("proposalName")).sendKeys("AUTOMATION TEST");
    driver.findElement(By.id("regionsPaneTitle")).click();
    driver.findElement(By.id("regionsPaneTitle")).click();
    Thread.sleep(500);
    /// driver.findElement(By.id("squareUpButton2")).click();
    driver.findElement(By.xpath("//input[@id='snapAzimuthButton1']")).click();
    driver.findElement(By.xpath("//input[@id='applySetbacksButton1']")).click();
    /// assertEquals("Setbacks cannot be less than zero.", closeAlertAndGetItsText());
    //// driver.findElement(By.id("delPolygonButton2")).click();
    Thread.sleep(1000);
    /// driver.findElement(By.id("squareUpButton3")).click();
    /// driver.findElement(By.id("squareUpButton3")).click();
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.cssSelector("div[title=\"Pan up\"]")).click();
    driver.findElement(By.cssSelector("div[title=\"Pan right\"]")).click();
    driver.findElement(By.cssSelector("div[title=\"Pan down\"]")).click();
    driver.findElement(By.cssSelector("div[title=\"Pan left\"]")).click();
    driver.findElement(By.cssSelector("div[title=\"Zoom out\"] > img")).click();
    driver.findElement(By.cssSelector("div[title=\"Zoom in\"] > img")).click();
    driver.findElement(By.id("accordion")).click();
    /////
    /////
    ////
    /// no need driver.findElement(By.xpath("//div[@id='solutionCategory']/ul/li[2]/h3")).click();
    /// no need driver.findElement(By.cssSelector("span.arrow")).click();
    driver.findElement(By.xpath("//input[@value='Next']")).click();
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.id("accordionTitleText")).click();
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.id("nextButton")).click();
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.id("contentUsagePaneTitle")).click();
    driver.findElement(By.id("accordion")).click();
    Thread.sleep(1000);
    // click on Inverters
    driver.findElement(By.xpath("//h3[text()= 'Inverters']")).click();

    // Click on Arrow

    driver.findElement(By.xpath("//span[@class = 'arrow']")).click();

    Thread.sleep(1000);
    // Default Invert select
    driver.findElement(By.xpath("html/body/ul/li[2]/span")).click();

    // Click on Arrow
    driver.findElement(By.xpath("//span[@class = 'arrow']")).click();

    Thread.sleep(2000);

    // Click on Next button
    driver.findElement(By.xpath("//input[@value='Next']")).click();
    Thread.sleep(2000);
    ////// errror--- driver.findElement(By.id("supplyLeadDetailsBtn1")).click();
    driver.findElement(By.id("accordion")).click();
    ///// driver.findElement(By.id("accordion")).click();
    ////// driver.findElement(By.id("accordion")).click();
    Thread.sleep(1500);

    ///// driver.findElement(By.id("backBtn")).click();
    //// driver.findElement(By.cssSelector("label > input[type=\"button\"]")).click();
    // Click on Next button

    driver.findElement(By.xpath("//input[@id='nextButton']")).click();

    /// PREVIEW PAGE STARTS HERE
    Thread.sleep(2000);

    driver.findElement(By.id("accordion")).click();
    Thread.sleep(250);
    driver.findElement(By.cssSelector("#buyForCashCheckbox")).click();
    Thread.sleep(250);
    driver.findElement(By.cssSelector("#nextButton")).click();
    Thread.sleep(1000);

    // ERROR: Caught exception [unknown command []]
  }
コード例 #29
0
  @Test
  public void testCreateFolderAndFiles() throws Exception {
    // Click Docushare
    driver.findElement(By.linkText("DOCUSHARE")).click();
    // Click Upload Document
    driver.findElement(By.cssSelector("span.show-file-add-form")).click();

    // Add To Document Locker
    // Enter Document Name
    driver
        .findElement(
            By.xpath("//form[@id='content-type-doc-loc-files-node-form']//input[@name='title']"))
        .clear();
    Tracking = func.RandomWords(3);
    driver
        .findElement(
            By.xpath("//form[@id='content-type-doc-loc-files-node-form']//input[@name='title']"))
        .sendKeys(Tracking[0] + " " + Tracking[1] + " " + Tracking[2]);
    // Upload File
    driver
        .findElement(
            By.xpath(
                "//div[contains(@class, 'field-name-field-doc-loc-uploaded-file-form')]//input"))
        .sendKeys("C:\\Users\\om\\Downloads\\abc.txt");
    // Click Save
    driver
        .findElement(
            By.xpath(
                "//form[@id='content-type-doc-loc-files-node-form']//input[@class='form-submit']"))
        .click();
    wait.until(
        ExpectedConditions.invisibilityOfElementLocated(
            By.xpath(
                "//form[@id='content-type-doc-loc-files-node-form']//input[@class='form-submit']")));

    // Click Hidden Checkbox using Actions Class
    WebElement Element =
        driver.findElement(
            By.xpath(
                "//form[@id='views-form-views-document-locker-files-block']//div[contains(@class, 'views-row-first')]"));
    WebElement HiddenElement =
        driver.findElement(
            By.xpath(
                "//form[@id='views-form-views-document-locker-files-block']//div[contains(@class, 'views-row-first')]//input[@type='checkbox']"));
    Actions action = new Actions(driver);
    // Move To Element
    action.moveToElement(Element).perform();
    // Wait For Checkbox To Be Shown
    Thread.sleep(200);
    // Click Checkbox
    action.click(HiddenElement).perform();
    // Click download button
    driver
        .findElement(By.xpath("//form[@id='download-files-form']//input[@class='form-submit']"))
        .click();

    // See Document in Different Form
    driver.findElement(By.cssSelector("span.show-file-list-form.file-showing-form")).click();
    driver.findElement(By.cssSelector("span.show-file-grid-form.file-showing-form")).click();

    // Click New Folder
    driver.findElement(By.cssSelector("span.show-folder-add-form")).click();
    // Create Folder
    // Enter Folder Name
    driver
        .findElement(
            By.xpath("//form[@id='content-type-doc-loc-folder-node-form']//input[@name='title']"))
        .clear();
    Tracking = func.RandomWords(2);
    driver
        .findElement(
            By.xpath("//form[@id='content-type-doc-loc-folder-node-form']//input[@name='title']"))
        .sendKeys(Tracking[0] + " " + Tracking[1]);
    // Select Parent
    func.SelectRandomSelectListOption(
        "//div[contains(@class, 'field-name-field-doc-loc-parent-folder-form')]//select");
    // Click Save
    driver
        .findElement(
            By.xpath("//form[@id='content-type-doc-loc-folder-node-form']//input[@type='submit']"))
        .click();
    wait.until(
        ExpectedConditions.invisibilityOfElementLocated(
            By.xpath(
                "//form[@id='content-type-doc-loc-folder-node-form']//input[@type='submit']")));
  }
コード例 #30
0
 @Test
 public void testNotificacaoObito() throws Exception {
   driver.get(baseUrl + "/sincap/");
   driver.findElement(By.id("username")).clear();
   driver.findElement(By.id("username")).sendKeys("111.111.111-11");
   driver.findElement(By.id("password")).clear();
   driver.findElement(By.id("password")).sendKeys("abc123");
   driver.findElement(By.id("botaoLogin")).click();
   driver.findElement(By.xpath("//ul[@id='dashboard-menu']/li[2]/a/span")).click();
   driver.findElement(By.id("obito-tipoObito")).click();
   new Select(driver.findElement(By.id("obito-tipoObito"))).selectByVisibleText("PCR");
   driver.findElement(By.cssSelector("option[value=\"PCR\"]")).click();
   new Select(driver.findElement(By.id("obito-paciente-documentoSocial-tipoDocumentoComFoto")))
       .selectByVisibleText("RG");
   driver.findElement(By.id("obito-paciente-documentoSocial-documento")).clear();
   driver.findElement(By.id("obito-paciente-documentoSocial-documento")).sendKeys("3546545333");
   driver.findElement(By.id("obito-paciente-nome")).clear();
   driver.findElement(By.id("obito-paciente-nome")).sendKeys("Notificacao de obito");
   driver.findElement(By.id("obito-paciente-dataNascimento")).clear();
   driver.findElement(By.id("obito-paciente-dataNascimento")).sendKeys("12/04/1985");
   driver.findElement(By.id("obito-paciente-dataInternacao")).clear();
   driver.findElement(By.id("obito-paciente-dataInternacao")).sendKeys("10/08/2015");
   driver.findElement(By.cssSelector("span.checked")).click();
   driver.findElement(By.id("obito-paciente-sexo:0")).click();
   driver.findElement(By.id("obito-paciente-nomeMae")).clear();
   driver.findElement(By.id("obito-paciente-nomeMae")).sendKeys("Mae do obito");
   driver.findElement(By.id("obito-paciente-numeroSUS")).clear();
   driver.findElement(By.id("obito-paciente-numeroSUS")).sendKeys("156234434345");
   driver.findElement(By.id("obito-paciente-numeroProntuario")).clear();
   driver.findElement(By.id("obito-paciente-numeroProntuario")).sendKeys("2564554643");
   driver.findElement(By.id("descricaoComentario")).clear();
   driver.findElement(By.id("descricaoComentario")).sendKeys("comentario 1");
   driver.findElement(By.id("btn-next")).click();
   driver.findElement(By.id("obito-dataObito")).clear();
   driver.findElement(By.id("obito-dataObito")).sendKeys("13/08/2015");
   driver.findElement(By.id("horarioObito")).clear();
   driver.findElement(By.id("horarioObito")).sendKeys("10:21");
   new Select(driver.findElement(By.id("obito-setor"))).selectByVisibleText("CIRURGIA GERAL");
   new Select(driver.findElement(By.id("obito-corpoEncaminhamento"))).selectByVisibleText("IML");
   driver.findElement(By.xpath("//div[@id='uniform-obito-aptoDoacao:0']/span")).click();
   driver.findElement(By.id("obito-aptoDoacao:0")).click();
   driver.findElement(By.id("obito-primeiraCausaMortis")).clear();
   driver.findElement(By.id("obito-primeiraCausaMortis")).sendKeys("causa 1");
   driver.findElement(By.id("obito-segundaCausaMortis")).clear();
   driver.findElement(By.id("obito-segundaCausaMortis")).sendKeys("causa 2");
   driver.findElement(By.id("obito-terceiraCausaMortis")).clear();
   driver.findElement(By.id("obito-terceiraCausaMortis")).sendKeys("causa 3");
   driver.findElement(By.id("obito-quartaCausaMortis")).clear();
   driver.findElement(By.id("obito-quartaCausaMortis")).sendKeys("causa 4");
   driver.findElement(By.xpath("(//button[@type='button'])[3]")).click();
 }