예제 #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
  // 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 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 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();
 }
예제 #5
0
  @Before
  public void setUp() throws Exception {
    driver = new FirefoxDriver();
    func = new COTFunctions(driver);
    driver.manage().timeouts().implicitlyWait(func.timeoutOFAllElement, TimeUnit.SECONDS);

    driver.get(func.baseUrl + "/");
    func.CheckLogin();
    func.LoginRole("SchoolAdmin");
    driver.get(func.baseUrl + "/college-search");
  }
예제 #6
0
  @Before
  public void setUp() throws Exception {
    driver = new FirefoxDriver();
    func = new COTFunctions(driver);
    wait = new WebDriverWait(driver, func.timeoutOfOneElement);
    driver.manage().timeouts().implicitlyWait(func.timeoutOFAllElement, TimeUnit.SECONDS);

    driver.get(func.baseUrl + "/");
    func.CheckLogin();
    func.LoginRole("Student");
    driver.get(func.baseUrl + "/document-locker");
  }
  @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");
    }
  }
예제 #8
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();
 }
예제 #9
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();
 }
 @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();
 }
예제 #13
0
파일: New4.java 프로젝트: TKosmacki/CS1632
 @After
 public void tearDown() throws Exception {
   driver.quit();
   String verificationErrorString = verificationErrors.toString();
   if (!"".equals(verificationErrorString)) {
     fail(verificationErrorString);
   }
 }
예제 #14
0
파일: New4.java 프로젝트: TKosmacki/CS1632
 private boolean isElementPresent(By by) {
   try {
     driver.findElement(by);
     return true;
   } catch (NoSuchElementException e) {
     return false;
   }
 }
예제 #15
0
파일: New4.java 프로젝트: TKosmacki/CS1632
 private boolean isAlertPresent() {
   try {
     driver.switchTo().alert();
     return true;
   } catch (NoAlertPresentException e) {
     return false;
   }
 }
예제 #16
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 {
   System.setProperty(
       "webdriver.chrome.driver",
       "C:\\Users\\om\\Downloads\\Programs\\Selenium\\chromedriver.exe");
   driver = new ChromeDriver();
   baseUrl = "http://collegeontrackdev.prod.acquia-sites.com/";
   driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
 }
 @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());
 }
예제 #19
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;
 }
예제 #22
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();
  }
예제 #23
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();
 }
예제 #24
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();
 }
예제 #25
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();
 }
예제 #26
0
 @Before
 public void setUp() throws Exception {
   FirefoxBinary binary = new FirefoxBinary(new File(FIREFOX_LOCATION));
   FirefoxProfile profile = new FirefoxProfile();
   driver = new FirefoxDriver(binary, profile);
   RegisterCustomerPage registerCustomerPage = new RegisterCustomerPage(driver);
   this.customerId =
       registerCustomerPage
           .registerCustomer(FIRSTNAME, LASTNAME, ADDRESS, ZIP, CITY, EMAIL, PASSWORD)
           .getCustomerId();
   driver.quit();
   driver = new FirefoxDriver(binary, profile);
 }
  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() );
    }
  }
예제 #28
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());
    }
  }
예제 #29
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();
 }
예제 #30
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();
 }