예제 #1
0
  public void uploadProfile(String provider, String name, String context, String version)
      throws InterruptedException, IOException {

    driver.findElement(By.id(uiElementMapper.getElement("my.profile.region.tab.id"))).click();

    driver
        .findElement(By.linkText(uiElementMapper.getElement("my.profile.new.profile.add.link")))
        .click();

    WebElement profileName =
        driver.findElement(By.id(uiElementMapper.getElement("my.profile.name.id")));
    profileName.sendKeys(provider);

    WebElement profileFirstName =
        driver.findElement(By.id(uiElementMapper.getElement("my.profile.first.name.id")));
    profileFirstName.sendKeys(name);

    WebElement profileLastName =
        driver.findElement(By.id(uiElementMapper.getElement("my.profile.last.name.id")));
    profileLastName.sendKeys(context);

    WebElement profileEmail =
        driver.findElement(By.id(uiElementMapper.getElement("my.profile.email.id")));
    profileEmail.sendKeys(version);

    JavascriptExecutor js = (JavascriptExecutor) driver;
    js.executeScript("validate()");

    log.info("successfully Saved");
  }
예제 #2
0
 /*Admin Login*/
 public void admin(String userAd, String passAd) {
   driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
   siteAdmin.click();
   userFieldAdmin.sendKeys(userAd);
   passFieldAdmin.sendKeys(passAd);
   loginButtonAdmin.click();
 }
 public void loginpanel1(String u, String p) {
   Username.sendKeys(u);
   Sleeper.sleepTightInSeconds(2);
   Password.sendKeys(p);
   Sleeper.sleepTightInSeconds(2);
   Login.click();
 }
예제 #4
0
 public void fillRegisterForm(
     final String nick,
     final String name,
     final String pass,
     final String em,
     final boolean withReturn,
     final boolean doScreenshot) {
   clearField(shortName);
   hightlight(shortName);
   shortName.sendKeys(nick);
   clearField(longName);
   hightlight(longName);
   longName.sendKeys(name);
   clearField(passwd);
   hightlight(passwd);
   passwd.sendKeys(pass);
   clearField(email);
   hightlight(email);
   email.sendKeys(em);
   hightlight(registerButton);
   if (doScreenshot) {
     SeleniumUtils.doScreenshot(getWebDriver(), "register");
     sleep(2000);
   }
   if (withReturn) {
     email.sendKeys(Keys.RETURN);
   } else {
     registerButton.click();
   }
 }
  @Test
  public void test() {
    // find a wish list
    wd.get(baseURL);
    wd.findElementByXPath(".//*[@id='term']").sendKeys("*****@*****.**");
    wd.findElementByXPath(".//*[@id='wish_list']/div[3]/div/form/fieldset[2]/input").click();

    wd.findElementByXPath(("//input[starts-with(@id,'safe_place_for_courier')]"))
        .sendKeys("home"); // use when there are dynamic elements on the page
    wd.findElementByXPath("//*[@id='add_to_cart']").click();

    WebElement checkoutmodal =
        wait.until(
            ExpectedConditions.visibilityOfElementLocated(
                By.xpath("//*[@id='shopping_buttons']/a[2]")));
    checkoutmodal.click();

    // proceed to checkout
    wd.findElementByXPath(".//*[@id='edit_cart']/section[2]/div/div[2]/span/button").click();

    // welcome page
    WebElement signinemail = wd.findElementByXPath("//*[@id='email']");
    if (signinemail.isEnabled()) signinemail.sendKeys("*****@*****.**");

    WebElement signinpassword = wd.findElementByXPath("//*[@id='password']");
    if (signinpassword.isEnabled()) signinpassword.sendKeys("logmein1");
    wd.findElementById("button_existing_customer").click();

    // Delivery
    wd.findElementById("button_continue").click();

    // Payment flow choice (QA only)
    wd.findElementByXPath(".//*[@id='content']/form/input").click();

    // Payment page
    wd.findElementByXPath(".//*[@id='payment_medium_payment_form_credit_card']").click();

    // Payment form

    wait.until(
        ExpectedConditions.visibilityOfElementLocated(
            By.id("checkout_credit_card_attributes_type")));
    new Select(wd.findElementById("checkout_credit_card_attributes_type"))
        .selectByVisibleText("Visa Debit or Electron");

    wd.findElementById("checkout_credit_card_attributes_number").sendKeys("4263971921001307");
    wd.findElementById("checkout_credit_card_attributes_name").sendKeys("Hans Peter Luhn");
    new Select(wd.findElementById("checkout_credit_card_attributes_expiry_month"))
        .selectByVisibleText("6");
    new Select(wd.findElementById("checkout_credit_card_attributes_expiry_year"))
        .selectByVisibleText("2018");
    wd.findElementById("checkout_credit_card_attributes_verification_value").sendKeys("737");

    // Skip 3DS
    wd.findElementById("checkout_skip_3d_secure").click();

    wd.findElementByXPath("//*[@id='process_payment_button']").click();

    wd.close();
  }
예제 #6
0
 private void doLogin(String userName, String password) {
   user_Name.sendKeys(userName);
   pwd.sendKeys(password);
   login.click();
   waitForExists("Xero | Dashboard | Demo", 20);
   System.out.println("test");
 }
  @Override
  public void keyUp(String locator, String keySequence) {
    WebElement webElement = getWebElement(locator);

    if (keySequence.startsWith("\\")) {
      int index = GetterUtil.getInteger(keySequence.substring(1));

      Keys keys = _keysArray[index];

      if ((index >= 48) && (index <= 90)) {
        webElement.sendKeys(StringPool.ASCII_TABLE[index]);
      } else if ((index == 16) || (index == 17) || (index == 18)) {
        WrapsDriver wrapsDriver = (WrapsDriver) webElement;

        WebDriver webDriver = wrapsDriver.getWrappedDriver();

        Actions actions = new Actions(webDriver);

        actions.keyUp(webElement, keys);

        Action action = actions.build();

        action.perform();
      } else {
        webElement.sendKeys(keys);
      }
    } else {
      webElement.sendKeys(keySequence);
    }
  }
  /**
   * Logs in to Showdown with the supplied information. Make password empty string if you wish to
   * use an unregistered account.
   */
  public void login(String userName, String password) {
    // Wait for the websocket connection to open...
    // This is technically waiting for the lobby window to initialise,
    // but this coincides with the socket opening so all G.
    waitForElementPresent(By.cssSelector("div.roomlist"));

    // If we store the By we risk accessing a stale element...
    String loginCssSelector = "button[name='login']";
    waitForElementPresent(By.cssSelector(loginCssSelector), 20);

    clickAt(By.cssSelector(loginCssSelector));
    WebElement usernameTextbox = driver.findElement(By.cssSelector("input[name='username']"));
    usernameTextbox.clear();
    usernameTextbox.sendKeys(userName);
    clickAt(By.cssSelector("button[type='submit']"));

    if (password.length() > 0) {
      waitForElementPresent(By.cssSelector("input[name='password']"));

      WebElement passwordTextbox = driver.findElement(By.cssSelector("input[name='password']"));
      passwordTextbox.clear();
      passwordTextbox.sendKeys(password);
      clickAt(By.cssSelector("button[type='submit']"));
    }
    currentUser = userName;
  }
예제 #9
0
  public void pesquisaPedido(WebDriver driver) throws InterruptedException {
    this.driver = driver;
    driver.get("http://*****:*****@id='btnPesquisar']/span[2]"));
    btnPesquisa.click();
  }
예제 #10
0
  @Test(expected = ElementNotVisibleException.class)
  public void throwExceptionWhenInteractingWithInvisibleElement() {
    server.setGetHandler(
        new HttpRequestCallback() {
          @Override
          public void call(HttpServletRequest req, HttpServletResponse res) throws IOException {
            res.getOutputStream()
                .println(
                    "<!DOCTYPE html>"
                        + "<html>"
                        + "    <head>\n"
                        + "        <title>test</title>\n"
                        + "    </head>\n"
                        + "    <body>\n"
                        + "        <input id=\"visible\">\n"
                        + "        <input style=\"display:none\" id=\"invisible\">\n"
                        + "    </body>"
                        + "</html>");
          }
        });

    WebDriver d = getDriver();
    d.get(server.getBaseUrl());

    WebElement visibleInput = d.findElement(By.id("visible"));
    WebElement invisibleInput = d.findElement(By.id("invisible"));

    String textToType = "text to type";
    visibleInput.sendKeys(textToType);
    assertEquals(textToType, visibleInput.getAttribute("value"));

    invisibleInput.sendKeys(textToType);
  }
예제 #11
0
  @Test
  public void testLogin() {
    driver.get(appUrl + "/#/login");

    WebDriverWait wait = new WebDriverWait(driver, 10);

    WebElement user =
        wait.until(
            ExpectedConditions.presenceOfElementLocated(By.cssSelector("input[type=\"text\"]")));
    user.sendKeys("demo");

    WebElement password =
        wait.until(
            ExpectedConditions.presenceOfElementLocated(
                By.cssSelector("input[type=\"password\"]")));
    password.sendKeys("demo");

    WebElement submit =
        wait.until(
            ExpectedConditions.presenceOfElementLocated(By.cssSelector("button[type=\"submit\"]")));
    submit.submit();

    boolean found =
        wait.until(
            ExpectedConditions.textToBePresentInElement(By.cssSelector("td"), "Assign Approver"));
  }
예제 #12
0
  public AccountPage setCountry(String country, WebDriver driver) {

    country_dropdown.click();
    country_search_fill.sendKeys(country);
    country_search_fill.sendKeys(Keys.ENTER);

    return this;
  }
  private void executeLogin(String email, String userid, String pseudonym) {

    EmailField.sendKeys(email);
    UserIdField.sendKeys(userid);
    PseudonymField.sendKeys(pseudonym);
    SubmitBtn.submit();
    System.out.println("debug: credentials SENT");
  }
예제 #14
0
 /**
  * @param username
  * @param password
  * @return DevPage object
  */
 public DevPage loginAs(String username, String password) {
   usernameIB.clear();
   usernameIB.sendKeys(username);
   passwordIB.clear();
   passwordIB.sendKeys(password);
   submitBtn.click();
   return PageFactory.initElements(driver, DevPage.class);
 }
 public TemplateProviderInlinePage createTemplateProvider(String space, String page) {
   spaceInput.clear();
   spaceInput.sendKeys(space);
   pageInput.clear();
   pageInput.sendKeys(page);
   createButton.click();
   return new TemplateProviderInlinePage();
 }
  @Test
  @RunAsClient
  @InSequence(6000)
  public void testFileUpload() throws Exception {

    waitForElement(browser, johnAdamsUserScreenNameCellXpath);
    (new Actions(browser)).doubleClick(johnAdamsUserScreenNameCell).perform();
    Thread.sleep(250);
    (new Actions(browser)).doubleClick(johnAdamsUserScreenNameCell).perform();

    waitForElement(browser, fileEntryXpath);

    fileEntry.sendKeys(getPathToJerseyFile());
    fileUploadButton.click();

    waitForElement(browser, changedPortraitXpath);

    logger.log(Level.INFO, "changedPortrait.isDisplayed() = " + changedPortrait.isDisplayed());
    assertTrue(
        "The Changed User Portrait should be displayed on the page at this point but it is not.",
        changedPortrait.isDisplayed());

    cancelButton.click();

    waitForElement(browser, johnAdamsUserScreenNameCellXpath);
    (new Actions(browser)).doubleClick(johnAdamsUserScreenNameCell).perform();
    Thread.sleep(250);
    (new Actions(browser)).doubleClick(johnAdamsUserScreenNameCell).perform();

    waitForElement(browser, fileEntryXpath);

    logger.log(Level.INFO, "portrait.isDisplayed() = " + portrait.isDisplayed());
    assertTrue(
        "The User Portrait should be displayed on the page at this point but it is not.",
        portrait.isDisplayed());

    fileEntry.sendKeys(getPathToJerseyFile());
    fileUploadButton.click();

    waitForElement(browser, changedPortraitXpath);

    submitButton.click();

    waitForElement(browser, johnAdamsUserScreenNameCellXpath);

    (new Actions(browser)).doubleClick(johnAdamsUserScreenNameCell).perform();
    Thread.sleep(250);
    (new Actions(browser)).doubleClick(johnAdamsUserScreenNameCell).perform();

    waitForElement(browser, changedPortraitXpath);

    logger.log(Level.INFO, "changedPortrait.isDisplayed() = " + changedPortrait.isDisplayed());
    assertTrue(
        "The Changed User Portrait should be displayed on the page at this point but it is not.",
        changedPortrait.isDisplayed());

    cancelButton.click();
  }
  @Test
  @RunAsClient
  @InSequence(4000)
  public void screenNameColumnFilter() throws Exception {

    waitForElement(browser, screenNameColumnFilterXpath);
    screenNameColumnFilter.sendKeys("john.adams");

    Thread.sleep(1000);

    logger.log(
        Level.INFO,
        "johnAdamsUserScreenNameCell.isDisplayed() = " + johnAdamsUserScreenNameCell.isDisplayed());
    assertTrue(
        "The Screen Name Cell of the John Adams user should be displayed on the page as john.adams at this point but it is not.",
        johnAdamsUserScreenNameCell.isDisplayed());
    logger.log(
        Level.INFO,
        "johnAdamsUserLastNameCell.isDisplayed() = " + johnAdamsUserLastNameCell.isDisplayed());
    assertTrue(
        "The Last Name Cell of the John Adams user should be displayed on the page as John at this point but it is not.",
        johnAdamsUserLastNameCell.isDisplayed());
    logger.log(
        Level.INFO,
        "johnAdamsUserLastNameCell.isDisplayed() = " + johnAdamsUserFirstNameCell.isDisplayed());
    assertTrue(
        "The First Name Cell of the John Adams user should be displayed on the page as Adams at this point but it is not.",
        johnAdamsUserFirstNameCell.isDisplayed());
    logger.log(
        Level.INFO,
        "johnAdamsUserEmailAddressCell.isDisplayed() = "
            + johnAdamsUserEmailAddressCell.isDisplayed());
    assertTrue(
        "The Email Address Cell of the John Adams user should be displayed on the page as [email protected] at this point but it is not.",
        johnAdamsUserEmailAddressCell.isDisplayed());

    logger.log(
        Level.INFO,
        "isThere(browser, samuelAdamsUserScreenNameCellXpath) = "
            + isThere(browser, samuelAdamsUserScreenNameCellXpath));
    assertFalse(
        "The row for Samuel Adams should NOT be displayed now becuase of filtering, but it is displayed.",
        isThere(browser, samuelAdamsUserScreenNameCellXpath));

    for (int i = 0; i < "john.adams".length(); i++) {
      screenNameColumnFilter.sendKeys(Keys.BACK_SPACE);
    }

    Thread.sleep(1000);

    logger.log(
        Level.INFO,
        "isThere(browser, samuelAdamsUserScreenNameCellXpath) = "
            + isThere(browser, samuelAdamsUserScreenNameCellXpath));
    assertTrue(
        "The row for Samuel Adams should be displayed now becuase of filtering, but it is not.",
        isThere(browser, samuelAdamsUserScreenNameCellXpath));
  }
예제 #18
0
  public PaymentMethodsPage login_fill(WebDriver driver, AccountData data) {

    WaitTool.waitForElementPresentAndVisible(driver, username_input);
    username_input.sendKeys(data.getUsername());
    password_input.sendKeys(data.getPassword());
    WaitTool.waitForElementPresentAndVisible(driver, login_button);
    login_button.click();
    return PageFactory.initElements(driver, PaymentMethodsPage.class);
  }
예제 #19
0
  public void login(String username, String password) {
    usernameInput.clear();
    usernameInput.sendKeys(username);

    passwordInput.clear();
    passwordInput.sendKeys(password);

    submitButton.click();
  }
예제 #20
0
 public void update(String firstName, String lastName, String email) {
   firstNameInput.clear();
   firstNameInput.sendKeys(firstName);
   lastNameInput.clear();
   lastNameInput.sendKeys(lastName);
   emailInput.clear();
   emailInput.sendKeys(email);
   submitButton.click();
 }
 public void testPasswordNOK() throws Exception {
   driver.get(this.baseUrl);
   WebElement userNameInputText = getInputText("username");
   userNameInputText.sendKeys("alberto");
   WebElement passwordInputText = getInputText("password");
   passwordInputText.sendKeys("45678");
   clickElement("login");
   assertThat(driver.getTitle(), is(equalTo("Sign On")));
 }
예제 #22
0
 /*Manage Categories*/
 public void categoryManage(String titleCat, String aliasC, String textCat) {
   catmanagerButton.click();
   newCategory.click();
   titleFieldCat.sendKeys(titleCat);
   aliasCat.sendKeys(aliasC);
   toggleEdCat.click();
   textFieldCategory.sendKeys(textCat);
   saveClose.click();
 }
  public void updateAccountInformation(String firstName, String lastName) {
    firstNameInput.clear();
    firstNameInput.sendKeys(firstName);

    lastNameInput.clear();
    lastNameInput.sendKeys(lastName);

    submitButton.click();
  }
예제 #24
0
  public void loginWithCredentials(String username, String password) {
    final WebElement usernameField = driver.findElement(By.name("username"));
    final WebElement passwordField = driver.findElement(By.name("password"));
    final WebElement loginForm = driver.findElement(By.tagName("form"));

    usernameField.sendKeys(username);
    passwordField.sendKeys(password);
    loginForm.submit();
  }
 public HomePage changePassword(UserObject user) throws IOException {
   signIn.click();
   //   currentPass.sendKeys(user.getPassword());
   password.sendKeys(user.getPasswordNew());
   confirmPassword.sendKeys(user.getPasswordNew());
   restore.click();
   app.wait(10);
   return app.createHomePage();
 }
 public DocumentBasePage createEventDocument(
     String title, String place, String startDate, String endDate) throws IOException {
   titleTextInput.sendKeys(title);
   placeTextInput.sendKeys(place);
   startDateTextInput.sendKeys(startDate);
   endDateTextInput.sendKeys(endDate);
   createButton.click();
   return asPage(DocumentBasePage.class);
 }
예제 #27
0
 /**
  * @param username
  * @param password
  * @throws TimeoutException
  * @throws NoSuchElementException
  */
 public void login(String username, String password)
     throws NoSuchElementException, TimeoutException {
   //		WebElement userName_editbox = driver.findElement(By.name("loginName"));
   WebElement userName_editbox = fluentWait(By.name("loginName"));
   WebElement password_editbox = driver.findElement(By.name("password"));
   userName_editbox.sendKeys(username);
   password_editbox.sendKeys(password);
   password_editbox.submit();
 }
  @Test
  public void invalidRedirectUriAllowsLoginThenShowErrorTest() throws InterruptedException {
    String invalidRedirectUri = "http://www.orcid.org/worng/redirect/uri";

    String formattedAuthorizationScreen =
        String.format(
            OauthAuthorizationPageHelper.authorizationScreenUrl,
            this.getWebBaseUrl(),
            this.getClient1ClientId(),
            SCOPES,
            invalidRedirectUri);
    formattedAuthorizationScreen += "&state=" + STATE_PARAM;
    formattedAuthorizationScreen += "#show_login";
    webDriver.get(formattedAuthorizationScreen);
    (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS, BBBUtil.SLEEP_MILLISECONDS))
        .until(BBBUtil.documentReady());
    (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS, BBBUtil.SLEEP_MILLISECONDS))
        .until(BBBUtil.angularHasFinishedProcessing());

    BBBUtil.extremeWaitFor(
        ExpectedConditions.presenceOfElementLocated(By.xpath("//input[@name='userId']")),
        webDriver);
    (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS, BBBUtil.SLEEP_MILLISECONDS))
        .until(BBBUtil.documentReady());
    (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS, BBBUtil.SLEEP_MILLISECONDS))
        .until(BBBUtil.angularHasFinishedProcessing());

    By userIdElementLocator = By.id("userId");
    (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS))
        .until(ExpectedConditions.presenceOfElementLocated(userIdElementLocator));
    WebElement userIdElement = webDriver.findElement(userIdElementLocator);
    userIdElement.sendKeys(this.getUser1UserName());
    (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS, BBBUtil.SLEEP_MILLISECONDS))
        .until(BBBUtil.angularHasFinishedProcessing());
    WebElement passwordElement = webDriver.findElement(By.id("password"));
    passwordElement.sendKeys(this.getUser1Password());
    (new WebDriverWait(webDriver, BBBUtil.TIMEOUT_SECONDS, BBBUtil.SLEEP_MILLISECONDS))
        .until(BBBUtil.angularHasFinishedProcessing());
    BBBUtil.ngAwareClick(webDriver.findElement(By.id("login-authorize-button")), webDriver);
    BBBUtil.extremeWaitFor(BBBUtil.angularHasFinishedProcessing(), webDriver);
    BBBUtil.extremeWaitFor(
        new ExpectedCondition<Boolean>() {
          public Boolean apply(WebDriver d) {
            return d.getCurrentUrl().contains("/oauth/error/redirect-uri-mismatch");
          }
        },
        webDriver);

    String currentUrl = webDriver.getCurrentUrl();
    assertTrue("URL is:" + currentUrl, currentUrl.contains("/oauth/error/redirect-uri-mismatch"));
    assertTrue(
        "URL is:" + currentUrl, currentUrl.contains("client_id=" + this.getClient1ClientId()));
    assertTrue("URL is:" + currentUrl, currentUrl.contains("response_type=code"));
    assertTrue("URL is:" + currentUrl, currentUrl.contains("redirect_uri=" + invalidRedirectUri));
    assertTrue("URL is:" + currentUrl, currentUrl.contains("scope="));
  }
예제 #29
0
  @Test
  public void testSearchFeature() {

    // find search, check if search works by sending a search time, see that results exist

    WebElement element = driver.findElement(By.name("search_block_form"));
    element.sendKeys("Laboon");
    element.sendKeys(Keys.RETURN);
    assert (driver.findElement(By.name("Laboon")) != null); // is it good enough?
  }
예제 #30
0
 public HomePage loginAs(String username, String password) throws IOException {
   testWebDriver.waitForElementToAppear(userNameField);
   testWebDriver.waitForElementToAppear(passwordField);
   userNameField.clear();
   userNameField.sendKeys(username);
   passwordField.sendKeys(password);
   testWebDriver.sleep(500);
   userNameField.submit();
   return new HomePage(testWebDriver);
 }