Ejemplo n.º 1
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();
 }
Ejemplo n.º 2
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();
 }
Ejemplo n.º 3
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();
 }
Ejemplo n.º 4
0
	/*
	Given: Logged into a valid account
	When: I look at the navigation bar
	Then: I will see a link for my user profile
	*/
	@Test
	public void testProfile(){
		driver.findElement(By.id("navbar_username")).clear();
		driver.findElement(By.id("navbar_username")).sendKeys("Aytros");
		driver.findElement(By.id("navbar_password")).clear();
		driver.findElement(By.id("navbar_password")).sendKeys("Mystra@428");
		driver.findElement(By.value("Log in")).click();
		String test = driver.findElement(By.linkText("Aytros")).getAttribute("title");
		assertTrue(test.contains("Profile"));
	}
Ejemplo n.º 5
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();
 }
 @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);
 }
Ejemplo n.º 7
0
 @Test
 public void testCreateFilm() throws Exception {
   driver.findElement(By.cssSelector("img[alt=\"Add movie\"]")).click();
   driver.findElement(By.name("name")).clear();
   driver.findElement(By.name("name")).sendKeys("Новый фильм");
   driver.findElement(By.name("year")).clear();
   driver.findElement(By.name("year")).sendKeys("1999");
   driver.findElement(By.name("duration")).clear();
   driver.findElement(By.name("duration")).sendKeys("90");
   driver.findElement(By.id("own_no")).click();
   driver.findElement(By.id("seen_no")).click();
   driver.findElement(By.id("submit")).click();
 }
Ejemplo n.º 8
0
 @Test
 public void testUntitled() throws Exception {
   driver.get(baseUrl + "en/login");
   driver.findElement(By.id("signin_username")).clear();
   driver.findElement(By.id("signin_username")).sendKeys("admin");
   driver.findElement(By.id("signin_password")).clear();
   driver.findElement(By.id("signin_password")).sendKeys("admin");
   driver.findElement(By.cssSelector("button.button")).click();
   driver.get(baseUrl + "/en/profile/edit");
   driver.findElement(By.xpath("(//img[@alt='Leave this community'])[3]")).click();
   assertTrue(closeAlertAndGetItsText().matches("^Are you sure[\\s\\S]$"));
   driver.findElement(By.xpath("(//img[@alt='Leave this community'])[2]")).click();
   assertTrue(closeAlertAndGetItsText().matches("^Are you sure[\\s\\S]$"));
   driver.findElement(By.cssSelector("a[alt=\"Leave\"]")).click();
   assertTrue(closeAlertAndGetItsText().matches("^Are you sure[\\s\\S]$"));
   driver.findElement(By.id("profile_community_comunity")).click();
   new Select(driver.findElement(By.id("profile_community_community")))
       .selectByVisibleText("My Sample Community #1");
   driver.findElement(By.cssSelector("button")).click();
   new Select(driver.findElement(By.id("profile_community_community")))
       .selectByVisibleText("My Sample Community #2");
   driver.findElement(By.cssSelector("button")).click();
   new Select(driver.findElement(By.id("profile_community_community")))
       .selectByVisibleText("CAPS");
   driver.findElement(By.cssSelector("button")).click();
   driver.findElement(By.cssSelector("button.button.submitButton")).click();
 }
Ejemplo n.º 9
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());
    }
  }
Ejemplo n.º 10
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();
 }
Ejemplo n.º 11
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();
 }
Ejemplo n.º 12
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();
 }
Ejemplo n.º 13
0
  @Test
  public void testLogin() throws Exception {
    // Create the file name and hope it's the same as created in Register Account
    //	  DateFormat dateFormat = new SimpleDateFormat("YYYYMMDDhh");
    //	  Date date = new Date();
    //	  String date1 = dateFormat.format(date);
    //	  File OutputFile = new File("C:\\Temp\\" + date1 + "-outputdata.txt");
    File OutputFile = new File("C:\\Users\\uqmpette\\Documents\\MatsTest-outputdata.txt");
    String loginUsername = null, loginPwd = "";
    if (OutputFile.exists()) {
      // File already exists, great, it should contain loginEmail
      // Create Object of java FileReader and BufferedReader class.
      FileReader FR = new FileReader(OutputFile);
      BufferedReader BR = new BufferedReader(FR);
      Number Row = 1;
      String Content = "";

      try {
        // Loop to read all lines one by one from file and print It.
        while ((Content = BR.readLine()) != null) {
          if (Row.equals(1)) {
            loginUsername = Content;
          }
          if (Row.equals(2)) {
            loginPwd = Content;
          }
          Row = 2;
        }
      } catch (FileNotFoundException e) {
        // Display error message if File was not found
        System.err.println("Unable to find the file");
      } catch (IOException e) {
        // Display error message if an exception is encountered while reading the file
        System.err.println("Unable to read the file");
      }
      BR.close();
    }

    // Applicant login (SSO)
    driver.findElement(By.id("userid1")).clear();
    driver.findElement(By.id("userid1")).sendKeys(loginUsername);
    driver.findElement(By.id("pwd")).clear();
    driver.findElement(By.id("pwd")).sendKeys(loginPwd);
    driver.findElement(By.xpath("//*[@id='login']/table/tbody/tr[6]/td[2]/input")).click();
    //	  Thread.sleep(2000);
    fluentWaitSI.fluentWait(By.id("fldra_HCAD_STUDENT_ADMISSIONS"));
  }
Ejemplo n.º 14
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]*$"));
 }
Ejemplo n.º 15
0
  @Test(
      dataProvider = "addCitizenshipInfo",
      dataProviderClass = applicantDataDomesticNewApplicant.class)
  public void testEnterDataCitizenshipResidencyDomestic(
      String citizenshipType,
      String domesticType,
      String fieldCitizenshipCountryId,
      String fieldBirthCountryId,
      String fieldResidenceCountryId,
      String ATSI)
      throws Exception {

    // Enter Citizenship
    driver.findElement(By.id(citizenshipType)).click();
    driver.findElement(By.id(domesticType)).click();

    Thread.sleep(300);
    selectFromSelect2.SelectDropDownOption("field-birthCountryId", fieldBirthCountryId);
    Thread.sleep(300);
    selectFromSelect2.SelectDropDownOption("field-residenceCountryId", fieldResidenceCountryId);

    driver.findElement(By.id("field-" + ATSI)).click();

    driver.findElement(By.xpath("//input[@value='Save']")).click();
    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if ("Saved".equals(driver.findElement(By.cssSelector("div.toast-message")).getText()))
          break;
      } catch (Exception e) {
        screenShots.takeScreenShot("enterDataCitResDom1");
      }
      Thread.sleep(1000);
    }

    // Goto Home or Dashboard
    driver.findElement(By.cssSelector("span.link-to-dashboard.dashboard-text")).click();
    try {
      assertEquals(
          "Profile Information", driver.findElement(By.cssSelector("h3.col-xs-12")).getText());
    } catch (Error e) {
      screenShots.takeScreenShot("enterDataCitResDom2");
      verificationErrors.append(e.toString());
    }
  }
 @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();
 }
 @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());
 }
Ejemplo n.º 18
0
  @Test
  public void testGoogleJunit4WDriver() throws Exception {
    driver.get("https://www.google.com.ua/");
    driver.findElement(By.id("lst-ib")).sendKeys("обучение собак");
    driver.findElement(By.name("btnG")).click();
    //	WebElement weblink= driver.findElement(By.xpath("//*[@id='rso']//a"));
    //	Actions builder = new Actions(driver);
    //	builder.contextClick(weblink).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.RETURN).build().perform();

  }
Ejemplo n.º 19
0
  @Test(expected = TimeoutException.class)
  public void shouldTimeoutWhileChangingIframeSource() {
    final String iFrameId = "iframeId";

    // Define HTTP response for test
    server.setGetHandler(
        new HttpRequestCallback() {
          @Override
          public void call(HttpServletRequest req, HttpServletResponse res) throws IOException {
            String pathInfo = req.getPathInfo();
            ServletOutputStream out = res.getOutputStream();

            if (pathInfo.endsWith("iframe_content.html")) {
              // nested frame 1
              out.println("iframe content");
            } else {
              // main page
              out.println(
                  "<html>\n"
                      + "<body>\n"
                      + "  <iframe id='"
                      + iFrameId
                      + "'></iframe>\n"
                      + "  <script>\n"
                      + "  setTimeout(function() {\n"
                      + "    document.getElementById('"
                      + iFrameId
                      + "').src='iframe_content.html';\n"
                      + "  }, 2000);\n"
                      + "  </script>\n"
                      + "</body>\n"
                      + "</html>");
            }
          }
        });

    // Launch Driver against the above defined server
    WebDriver d = getDriver();
    d.get(server.getBaseUrl());

    // Switch to iframe
    d.switchTo().frame(iFrameId);
    assertEquals(0, d.findElements(By.id(iFrameId)).size());
    assertFalse(d.getPageSource().toLowerCase().contains("iframe content"));

    new WebDriverWait(d, 5)
        .until(
            new Predicate<WebDriver>() {
              @Override
              public boolean apply(@Nullable WebDriver driver) {
                assertEquals(0, driver.findElements(By.id(iFrameId)).size());
                return (Boolean) ((JavascriptExecutor) driver).executeScript("return false;");
              }
            });
  }
Ejemplo n.º 20
0
  private void checkDemoPage(String lang) throws InterruptedException {
    checkElementVisible("page_loader", false);
    checkElementVisible("login_widget", false);
    checkElementVisible("webapp_ctx", true);
    checkElementVisible("error_window", false);
    checkElementVisible("success_window", true);

    // Extra check
    checkWidgetsOnLogin();

    // Check success message
    assertEquals(
        "Success message doesn't match",
        getLabelText(lang, "LL_DEMO_MSG"),
        driver.findElement(By.id("ok_msg")).getText());
    // Click on close button
    driver.findElement(By.id("success_window")).findElement(By.className("b-close")).click();

    Thread.sleep(1000);

    checkElementVisible("webapp_ctx", true);
    checkElementVisible("error_window", false);
    checkElementVisible("success_window", false);

    // Check color of message
    WebElement dmsg = driver.findElement(By.className("demo"));
    assertEquals(
        "demo message color doesn't match", "rgba(128, 128, 128, 1)", dmsg.getCssValue("color"));

    checkButtonById(lang, "ll_error", true);
    checkButtonById(lang, "ll_logout", true);

    // Check &  Press error button
    WebElement err = driver.findElement(By.id("ll_error"));
    err.click();
    Thread.sleep(500);
    checkErrorWin(
        lang,
        "C-DEMO",
        getLabelText(lang, "LL_INFO_MSG"),
        getLabelText(lang, "LL_DETAIL_MSG_1") + "\n" + getLabelText(lang, "LL_DETAIL_MSG_2"));
  }
Ejemplo n.º 21
0
  @Test
  public void testFindKioskFlow() throws Exception {
    driver.findElement(By.xpath("//a[contains(@href, '/fluffbox-rwx/kiosk/find')]")).click();
    driver.findElement(By.id("searchCriteria")).sendKeys("Ft. Lauderdale");
    driver.findElement(By.id("searchButton")).click();

    WebElement walgreensInsideLink = waitForDynamicElement(By.linkText("Walgreens (Inside)"));
    walgreensInsideLink.click();

    WebElement gMapInfoWindow =
        waitForDynamicElement(By.cssSelector("div.gmnoprint > div.gmnoprint > div > div"));
    assertThat(gMapInfoWindow.getText(), containsString("3895 W Broward Blvd"));

    WebElement winnDixieOutsideLink = waitForDynamicElement(By.linkText("Winn Dixie (Outside)"));
    winnDixieOutsideLink.click();

    gMapInfoWindow =
        waitForDynamicElement(By.cssSelector("div.gmnoprint > div.gmnoprint > div > div"));
    assertThat(gMapInfoWindow.getText(), containsString("1531 N State Road 7"));
  }
Ejemplo n.º 22
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);
  }
Ejemplo n.º 23
0
 @Test
 public void testUntitled2() throws Exception {
   driver.get(baseUrl + "php4dvd/");
   WebElement userNameWebEdit = driver.findElement(By.id("username"));
   WebElement passwordWebEdit = driver.findElement(By.name("password"));
   WebElement subminButton = driver.findElement(By.name("submit"));
   userNameWebEdit.clear();
   userNameWebEdit.sendKeys("admin");
   passwordWebEdit.clear();
   passwordWebEdit.sendKeys("admin");
   subminButton.click();
 }
  @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");
    }
  }
Ejemplo n.º 25
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();
 }
Ejemplo n.º 26
0
  // Profile creation - step 1
  private void profilePage1() throws InterruptedException {

    driver.manage().window().maximize();
    driver.findElement(By.cssSelector("li")).click();
    new Select(driver.findElement(By.id("profileGender"))).selectByVisibleText("Woman");
    driver.findElement(By.cssSelector("option[value=\"3\"]")).click();
    new Select(driver.findElement(By.id("profileLookingGender"))).selectByVisibleText("Man");
    driver.findElement(By.cssSelector("#profileLookingGender > option[value=\"2\"]")).click();
    driver.findElement(By.id("profileLookingMinAge")).click();
    new Select(driver.findElement(By.id("profileLookingMinAge"))).selectByVisibleText("20");
    driver.findElement(By.cssSelector("option[value=\"20\"]")).click();
    new Select(driver.findElement(By.id("profileLookingMaxAge"))).selectByVisibleText("36");
    driver.findElement(By.cssSelector("#profileLookingMaxAge > option[value=\"36\"]")).click();
    driver.findElement(By.cssSelector("#country > option[value=\"39\"]")).click();
    driver.findElement(By.id(("postalCode"))).click();
    driver.findElement(By.id(("postalCode"))).clear();
    driver.findElement(By.id(("postalCode"))).sendKeys("H3S1H4");
    driver.findElement(By.id("submit")).click();
    Thread.sleep(5000);
  }
Ejemplo n.º 27
0
  @Test(
      dataProvider = "addNewAgentApplicant",
      dataProviderClass = applicantDataInternationalNewApplicant.class)
  public void testEnterDataAddNewApplicant(
      String loginEmail,
      String loginPassword,
      String firstName,
      String lastName,
      String birthDay,
      String birthMonth,
      String birthYear)
      throws Exception {

    // Add new applicant to Agent
    Thread.sleep(300);
    // Test case from HERE to CITIZENSHIP will fail if the applicant already exists.
    driver.findElement(By.id("field-email")).clear();
    driver.findElement(By.id("field-email")).sendKeys(loginEmail);
    Thread.sleep(150);
    driver.findElement(By.id("field-confirmEmail")).clear();
    driver.findElement(By.id("field-confirmEmail")).sendKeys(loginEmail);

    Thread.sleep(100);
    driver.findElement(By.id("field-firstName")).clear();
    driver.findElement(By.id("field-firstName")).sendKeys(firstName);

    driver.findElement(By.id("field-lastName")).clear();
    driver.findElement(By.id("field-lastName")).sendKeys(lastName);

    new Select(driver.findElement(By.name("dayOfBirth"))).selectByVisibleText(birthDay);
    new Select(driver.findElement(By.name("monthOfBirth"))).selectByVisibleText(birthMonth);
    new Select(driver.findElement(By.name("yearOfBirth"))).selectByVisibleText(birthYear);

    driver.findElement(By.xpath("//button[@type='submit']")).click();

    System.out.println("Applicant = " + loginEmail);
    Thread.sleep(500);

    try {
      assertEquals(
          "Profile Information", driver.findElement(By.cssSelector("h3.col-xs-12")).getText());
    } catch (Error e) {
      screenShots.takeScreenShot("enterDataAddNewAppl");
      verificationErrors.append(e.toString());
    }
  }
Ejemplo n.º 28
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();
 }
 @Test
 public void testAssigneUsScrumMaster2() 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("product");
   driver.findElement(By.xpath("//input[@value='Login']")).click();
   driver.findElement(By.cssSelector("input.btn.btn-success")).click();
   driver.findElement(By.id("tag_input")).clear();
   driver.findElement(By.id("tag_input")).sendKeys("Crea Git");
   driver.findElement(By.id("description_input")).clear();
   driver.findElement(By.id("description_input")).sendKeys("Creation Depot git");
   driver.findElement(By.id("priority_input")).clear();
   driver.findElement(By.id("priority_input")).sendKeys("1");
   driver.findElement(By.id("difficulty_input")).clear();
   driver.findElement(By.id("difficulty_input")).sendKeys("5");
   new Select(driver.findElement(By.id("master_input"))).selectByVisibleText("Scrum1 Master1");
   driver.findElement(By.cssSelector("button.btn.btn-success")).click();
   driver.findElement(By.linkText("Sign out")).click();
 }
Ejemplo n.º 30
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();
  }