// 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());
 }
 @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();
 }
Exemple #4
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();
 }
  //  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);
    }
  }
  @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());
    }
  }
 @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 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();
 }
Exemple #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());
    }
  }
 @Test
 public void testLoginMaster2() throws Exception {
   driver.get(baseUrl + "/login.html");
   driver.findElement(By.name("j_username")).clear();
   driver.findElement(By.name("j_username")).sendKeys("*****@*****.**");
   driver.findElement(By.name("j_password")).clear();
   driver.findElement(By.name("j_password")).sendKeys("master");
   driver.findElement(By.xpath("//input[@value='Login']")).click();
   driver.findElement(By.linkText("Sign out")).click();
 }
 @Test
 public void 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());
 }
  @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 []]
  }
 // ** vérifier que les champs banque, identifiant et banque sont obligatoires
 @Test
 public void testSSV8VALDEBTA008bIntegrationTests() 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 2");
   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("ReasRp_021");
   findElement(By.cssSelector("img[alt=\"save2\"]")).click();
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).sendKeys("ReasRp_021");
   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:inputLabeeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).sendKeys("ReasRp_022");
   findElement(By.cssSelector("img[alt=\"save2\"]")).click();
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys("ReasRp_022");
   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();
   findElement(By.cssSelector("img[alt=\"save2\"]")).click();
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys("ReasRp_023");
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).sendKeys("ReasRp_023");
   findElement(By.cssSelector("img[alt=\"save2\"]")).click();
   findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click();
   findElement(By.xpath("(//img[@alt='English'])[2]")).click();
 }
Exemple #14
0
 @Test
 public void testTemp() throws Exception {
   driver.get("http://cse.unl.edu/~mouna/WebApps/AddressBook/addressbookv3.4.7/index.php");
   driver
       .findElement(
           By.cssSelector(
               "html > body > table > tbody > tr:nth-child(2) > td:nth-child(3) > form > table:nth-child(2) > tbody > tr:nth-child(1) > td:nth-child(7) > a > img"))
       .click();
   driver.findElement(By.name("firstname")).clear();
   driver.findElement(By.name("firstname")).sendKeys("JamesEDIT");
   driver.findElement(By.name("lastname")).clear();
   driver.findElement(By.name("lastname")).sendKeys("PittEDIT");
   driver.findElement(By.name("address")).clear();
   driver.findElement(By.name("address")).sendKeys("44545 R street EDIT");
   driver.findElement(By.name("home")).clear();
   driver.findElement(By.name("home")).sendKeys("454545455 8989");
   driver.findElement(By.name("mobile")).clear();
   driver.findElement(By.name("mobile")).sendKeys("454554555 2398");
   driver.findElement(By.name("work")).clear();
   driver.findElement(By.name("work")).sendKeys("455455555 32323");
   driver.findElement(By.name("email")).clear();
   driver.findElement(By.name("email")).sendKeys("[email protected] EDIT");
   driver.findElement(By.name("email2")).clear();
   driver.findElement(By.name("email2")).sendKeys("[email protected] EDIT");
   driver.findElement(By.name("address2")).clear();
   driver.findElement(By.name("address2")).sendKeys("EDIT");
   driver.findElement(By.name("phone2")).clear();
   driver.findElement(By.name("phone2")).sendKeys("EDIT");
   driver.findElement(By.name("update")).click();
 }
  @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();
  }
Exemple #16
0
  @Test
  public void testVip7day() throws Exception {

    driver
        .manage()
        .timeouts()
        .implicitlyWait(30, TimeUnit.SECONDS); // неявное ожидание при каждом поиске элементов
    driver.get("http://mylove.ru");

    driver.findElement(By.id("mprofile_link")).click();
    driver.findElement(By.cssSelector("#isvip")).click();

    if (isElementPresent(By.xpath("//*[@id='settings']"))) {
      driver.findElement(By.xpath("//*[@id='settings']//a[contains(@class,'techbutton')]")).click();
    }
    Pattern pat = Pattern.compile("[-]?[0-9]+(.[0-9]+)?");
    // String Str1= driver.findElement(By.cssSelector("div.vipend > i")).getText();
    String Str1 =
        driver
            .findElement(
                By.cssSelector("#body > div.window.pay_window > div > div.paymay > div.vipend > i"))
            .getText();

    Matcher matcher1 = pat.matcher(Str1);
    while (matcher1.find()) Str1 = matcher1.group(); // что-то происходит

    Str1 = Str1.replaceAll(" ", "");
    Integer i1 = Integer.valueOf(Str1);
    // driver.findElement(By.xpath("//*[@id=\"vip_settings\"]/div[2]/a[1]")).click(); тоже верно

    driver.findElement(By.cssSelector("#vip_settings  div.pcols > a")).click();

    Thread.sleep(
        1000); /// без ожидания не успевает измениться выбранное значение дней, потом заменить на
               // явное ожидание с условием
    driver
        .findElement(By.cssSelector("div.pay_variant.pay_bill.pay_variant_cash > a"))
        .click(); // Платим со счета

    WebDriverWait wait = new WebDriverWait(driver, 20);
    wait.until(
        ExpectedConditions.stalenessOf(
            driver.findElement(
                By.cssSelector(
                    "#isvip")))); // подождем когда какой то DOM исчезнет(( чтобы посмотреть сколько
                                  // теперь дней до окончания випа, долго работает

    driver.findElement(By.cssSelector("#isvip")).click();
    driver.findElement(By.xpath("//*[@id='settings']//a[contains(@class,'techbutton')]")).click();
    String Str2 = driver.findElement(By.cssSelector("div.vipend > i")).getText();

    Matcher matcher2 = pat.matcher(Str2);

    while (matcher2.find()) Str2 = matcher2.group();
    Str2 = Str2.replaceAll(" ", ""); // если дней больше 1000 то строка с пробелами
    Integer i2 = Integer.valueOf(Str2);
    i1 = i1 + 7;

    // Проверим что количество дней випа увеличилось на 7
    assertEquals(i2, i1);
  };
  // Test Case 1: Postal Code Missing - Error
  private void newProfilePostalCodeEmpty() 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("submit")).click();

    System.out.println("ERROR: Postal Code is Empty");
    Thread.sleep(5000);
  }
  // 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);
  }
  @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");
    }
  }
  @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);
  }
 @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 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());
   }
 }
Exemple #23
0
  @Test
  public void LFTMain() throws Exception {
    JavascriptExecutor js = (JavascriptExecutor) webDriver;
    selenium.open(baseUrl);
    selenium.type("id=id_username", sender);
    selenium.type("id=id_password", "123abc");
    selenium.click("css=input[type=\"submit\"]");

    selenium.waitForPageToLoad("2000");

    System.out.println("First: The page title is " + selenium.getTitle());
    // code to upload file

    driver.findElement(By.linkText("Compose")).click();

    selenium.waitForPageToLoad("3000");

    // Runtime.getRuntime().exec("C:\\Users\\Sneha\\Desktop\\IE.exe");
    Runtime.getRuntime().exec("C:\\Users\\Sneha\\Desktop\\silver_autoit.exe");

    Functions.MyWaitfunc(driver, "//*[@id='uploader_browse']");
    WebElement ele = driver.findElement(By.xpath("//*[@id='uploader_browse']"));
    ele.click();

    // ele.sendKeys("C:\\Users\\Sneha\\Desktop\\Lighthouse.jpg");

    // send secure mail
    // driver.findElement(By.id("secure")).click();

    driver.findElement(By.id("addrin")).sendKeys(recipient);

    driver.findElement(By.id("id_subject")).sendKeys(stringToTest_tc001);

    String torun = "document.getElementById('tinymce').innerHTML='Hi there!'";

    driver.findElement(By.id("addrsubmit")).click();

    /*selenium.waitForPageToLoad("3000");

    		Thread.sleep(100);
    		js.executeScript(torun);

    		System.out.println((String)js.executeScript("return document.title"));

    */

    driver.switchTo().frame("id_body_ifr");

    selenium.typeKeys("//body[@id='tinymce']", "Finally wohoooo!!");
    driver.switchTo().defaultContent();

    driver.findElement(By.id("submitter")).click();

    /* code only if it is LFT

    String per_done="//html/body/div/div[2]/div[4]/form/fieldset/div[9]/div/div/div/div[2]/table[2]/tbody/tr/td[3]/span";
    NoSuchElementException e1 = null;

    // code to wait for file to be uploaded
    for (int second = 0;; second++) {

    	if (second >= 60) {fail("timeout");}
    	try { if (driver.findElement(By.xpath(per_done)).getText().equalsIgnoreCase("548 KB")) break; } catch (Exception e) {}
    	Thread.sleep(1000);


    }
    */
    // mail body

    /* code to run if LFT
    //System.out.println((String)js.
    if((this.doesWebElementExist(driver,By.xpath(per_done))) && (driver.findElement(By.xpath(per_done)).getText().equalsIgnoreCase("548 KB")))

    	{//driver.findElement(By.id("submitter")).click();
    	}

    else
    	throw e1;

    */

    /* this section if confirm dialog pops up!

    this.MyWaitfunc("//html/body/div[4]/div[11]/div/button/span");

          if(driver.findElement(By.xpath("//html/body/div[4]/div[11]/div/button/span")).isDisplayed())

    	driver.findElement(By.xpath("//html/body/div[4]/div[11]/div/button/span")).click();
    else
    	System.out.println("Confirm dialog not up yet!");
    */

    // to check if mail was sent successfully

    String success_str_xpath = "//html/body/div/div[2]/div[3]/ul/li";

    Functions.MyWaitfunc(driver, success_str_xpath);
    if ((Functions.doesWebElementExist(driver, By.xpath(success_str_xpath)))
        && (driver
            .findElement(By.xpath(success_str_xpath))
            .getText()
            .contains("Successfully sent the email")))
      System.out.println("SUCCESS:Mail successfully sent !");
    else {
      System.out.println("FAIL:Mail NOT SENT !");
      System.out.println(driver.findElement(By.xpath(success_str_xpath)).getText());
      Exception e1 = null;
      throw e1;
    }
  }
 // *** 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();
 }
Exemple #25
0
 @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();
 }
  // Test Case 6: Password Empty - Error
  private void profileSetUpPasswordEmpty() throws InterruptedException {

    profilePage1();
    driver.findElement(By.id("nickName")).click();
    driver.findElement(By.id("nickName")).clear();
    driver.findElement(By.id("nickName")).sendKeys("Neel");

    new Select(driver.findElement(By.id("DOBMonth"))).selectByVisibleText("January");
    driver.findElement(By.cssSelector("option[value=\"01\"]")).click();
    new Select(driver.findElement(By.id("DOBDay"))).selectByVisibleText("04");
    driver.findElement(By.cssSelector("#DOBDay > option[value=\"02\"]")).click();
    new Select(driver.findElement(By.id("DOBYear"))).selectByVisibleText("1994");
    driver.findElement(By.cssSelector("option[value=\"1994\"]")).click();

    driver.findElement(By.id("email")).click();
    driver.findElement(By.id("email")).clear();
    driver.findElement(By.id("email")).sendKeys("*****@*****.**");

    driver.findElement(By.id("emailConfirmation")).click();
    driver.findElement(By.id("emailConfirmation")).clear();
    driver.findElement(By.id("emailConfirmation")).sendKeys("*****@*****.**");

    driver.findElement(By.id("password")).click();
    driver.findElement(By.id("password")).clear();

    Thread.sleep(3000);

    driver.findElement(By.cssSelector("input.submitButton.green")).click();
    Thread.sleep(3000);
    System.out.println("ERROR: Password Missing");
  }
  // Test Case 8: Validating the view and edit profile - Changing fields in mini-profile to see the
  // changes displayed
  private void profileEditViewSetUp() throws InterruptedException {
    profilePage1();
    String emailShuffled = shuffleEmail(email);
    driver.findElement(By.id("nickName")).click();
    driver.findElement(By.id("nickName")).clear();
    driver.findElement(By.id("nickName")).sendKeys("Neel");

    new Select(driver.findElement(By.id("DOBMonth"))).selectByVisibleText("January");
    driver.findElement(By.cssSelector("option[value=\"01\"]")).click();
    new Select(driver.findElement(By.id("DOBDay"))).selectByVisibleText("04");
    driver.findElement(By.cssSelector("#DOBDay > option[value=\"02\"]")).click();
    new Select(driver.findElement(By.id("DOBYear"))).selectByVisibleText("1994");
    driver.findElement(By.cssSelector("option[value=\"1994\"]")).click();

    driver.findElement(By.id("email")).click();
    driver.findElement(By.id("email")).clear();
    driver.findElement(By.id("email")).sendKeys(emailShuffled + "@def.com");

    driver.findElement(By.id("emailConfirmation")).click();
    driver.findElement(By.id("emailConfirmation")).clear();
    driver.findElement(By.id("emailConfirmation")).sendKeys(emailShuffled + "@def.com");

    driver.findElement(By.id("password")).click();
    driver.findElement(By.id("password")).clear();
    driver.findElement(By.id("password")).sendKeys("target");

    Thread.sleep(3000);

    driver.findElement(By.cssSelector("input.submitButton.green")).click();

    driver.findElement(By.id("headline")).click();
    driver.findElement(By.id("headline")).clear();
    driver.findElement(By.id("headline")).sendKeys("I am fine!!!");

    driver.findElement(By.id("country")).click();
    new Select(driver.findElement(By.id("country"))).selectByVisibleText("Canada");
    driver.findElement(By.cssSelector("option[value=\"39\"]")).click();

    driver.findElement(By.id("postalCode")).click();
    driver.findElement(By.id("postalCode")).clear();
    driver.findElement(By.id("postalCode")).sendKeys("H3S1H4");

    new Select(driver.findElement(By.id("education"))).selectByVisibleText("Graduate degree");
    driver.findElement(By.cssSelector("#education > option[value=\"7\"]")).click();

    new Select(driver.findElement(By.id("occupation"))).selectByVisibleText("Artist");
    driver.findElement(By.cssSelector("#occupation > option[value=\"15\"]")).click();

    new Select(driver.findElement(By.id("relationship"))).selectByVisibleText("Single");
    driver.findElement(By.cssSelector("#relationship > option[value=\"3\"]")).click();

    // driver.findElement(By.id("income")).click();
    new Select(driver.findElement(By.id("income"))).selectByVisibleText("$25,000-$50,000");
    driver.findElement(By.cssSelector("#income > option[value=\"4\"]")).click();

    // driver.findElement(By.id("religion")).click();
    new Select(driver.findElement(By.id("religion"))).selectByVisibleText("Other");
    driver.findElement(By.cssSelector("#religion > option[value=\"3\"]")).click();

    // driver.findElement(By.id("fbCloseButton")).click();
    new Select(driver.findElement(By.id("height"))).selectByVisibleText("5ft. 6in.");
    driver.findElement(By.cssSelector("#height > option[value=\"166\"]")).click();

    // driver.findElement(By.id("ethnicity")).click();
    new Select(driver.findElement(By.id("ethnicity"))).selectByVisibleText("Asian");
    driver.findElement(By.cssSelector("#ethnicity > option[value=\"5\"]")).click();

    // driver.findElement(By.id("bodyType")).click();
    new Select(driver.findElement(By.id("bodyType"))).selectByVisibleText("Average");
    driver.findElement(By.cssSelector("#bodyType > option[value=\"5\"]")).click();

    // driver.findElement(By.id("eyeColor")).click();
    new Select(driver.findElement(By.id("eyeColor"))).selectByVisibleText("Black");
    driver.findElement(By.cssSelector("#eyeColor > option[value=\"8\"]")).click();

    // driver.findElement(By.id("hairColor")).click();
    new Select(driver.findElement(By.id("hairColor"))).selectByVisibleText("Black");
    driver.findElement(By.cssSelector("#hairColor > option[value=\"7\"]")).click();

    // driver.findElement(By.id("smoking")).click();
    new Select(driver.findElement(By.id("smoking"))).selectByVisibleText("Often");
    driver.findElement(By.cssSelector("#smoking > option[value=\"5\"]")).click();

    // driver.findElement(By.id("alcohol")).click();
    new Select(driver.findElement(By.id("alcohol"))).selectByVisibleText("Occasionally");
    driver.findElement(By.cssSelector("#alcohol > option[value=\"4\"]")).click();

    driver.findElement(By.cssSelector("input.submitButton.green")).click();
    Thread.sleep(3000);
    driver.findElement(By.linkText("I promise to upload a photo later")).click();
    Thread.sleep(3000);
    driver.findElement(By.linkText("close")).click();
    viewEditProfile();
  }
  private void viewEditProfile() throws InterruptedException {

    driver.findElement(By.linkText("My Profile")).click();
    driver.findElement(By.linkText("View Profile")).click();
    // driver.findElement(By.id("photoBlockClose")).click();
    driver.findElement(By.linkText("My Profile")).click();
    driver.findElement(By.linkText("Edit my profile")).click();

    new Select(driver.findElement(By.id("ethnicity"))).selectByVisibleText("Mixed Race");
    new Select(driver.findElement(By.id("height"))).selectByVisibleText("4ft. 10in.");
    Thread.sleep(4000);
    driver.findElement(By.id("submit_basic_information")).click();
    Thread.sleep(4000);

    driver.findElement(By.id("aboutMyself")).click();
    driver.findElement(By.id("aboutMyself")).clear();
    driver
        .findElement(By.id("aboutMyself"))
        .sendKeys("this is 5145502181, email [email protected], web: www.abc.com");
    Thread.sleep(4000);
    driver.findElement(By.id("submit_about_myself")).click();
    Thread.sleep(4000);

    driver.findElement(By.id("lookingFor")).click();
    driver.findElement(By.id("lookingFor")).clear();
    driver
        .findElement(By.id("lookingFor"))
        .sendKeys("my url is www.kala.com, 4389439088, email id is [email protected]");
    Thread.sleep(4000);
    driver.findElement(By.id("submit_who_im_looking_for")).click();
    Thread.sleep(4000);

    driver.findElement(By.linkText("My Profile")).click();
    driver.findElement(By.linkText("View Profile")).click();
    Thread.sleep(3000);

    verifyChanges();
  }
Exemple #29
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]*$"));
 }
Exemple #30
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();
 }