Example usage for org.openqa.selenium Keys RETURN

List of usage examples for org.openqa.selenium Keys RETURN

Introduction

In this page you can find the example usage for org.openqa.selenium Keys RETURN.

Prototype

Keys RETURN

To view the source code for org.openqa.selenium Keys RETURN.

Click Source Link

Usage

From source file:com.itson.servicedesigncenter.SdcPages.java

License:Open Source License

public SdcPages setNetworkCdmaNumber(String value) {
    browser.logAction("Inputing description: " + value);
    networkCdmaNumber = value;/*ww  w. j  a v a 2 s  .c  o m*/
    browser.logAction("got setNetworkCdmaNumber " + networkCdmaNumber);
    subscriberGroupMatcherPhoneNumber.sendKeys(networkCdmaNumber, Keys.RETURN);
    return this;
}

From source file:com.itson.servicedesigncenter.SdcPages.java

License:Open Source License

public SdcPages setMccMnc(String value) {
    browser.logAction("Inputing description: " + value);
    networkMccMnc = value;//  w ww  .ja v a2 s.  co  m
    networkGroupMccMncfield.sendKeys(value, Keys.RETURN);
    return this;
}

From source file:com.mgmtp.jfunk.web.util.WebDriverTool.java

License:Apache License

/**
 * Opens a new window and switches to it. The window to switch to is determined by diffing
 * the given {@code existingWindowHandles} with the current ones. The difference must be
 * exactly one window handle which is then used to switch to.
 *
 * @param openClickBy// w  w  w  .  j  ava2  s  .com
 *            identifies the element to click on in order to open the new window
 * @param timeoutSeconds
 *            the timeout in seconds to wait for the new window to open
 * @return the handle of the window that opened the new window
 */
public String openNewWindow(final By openClickBy, final long timeoutSeconds) {
    checkTopmostElement(openClickBy);
    return openNewWindow(() -> sendKeys(openClickBy, Keys.chord(Keys.CONTROL, Keys.RETURN)), timeoutSeconds);
}

From source file:com.opera.core.systems.FormSubmissionTest.java

License:Apache License

@Test
public void keysReturnSubmitsForm() {
    input.sendKeys("foo", Keys.RETURN);
    assertPassed();
}

From source file:com.pentaho.ctools.cda.MondrianJNDI.java

License:Apache License

/**
 * ############################### Test Case 2 ###############################
 *
 * Test Case Name:/*  ww  w.  ja v  a  2s. c  o m*/
 *    Select Data Access
 * Description:
 *    The test case pretends to validate the data presented when we select a
 *    data access, checking the ordering and search.
 * Steps:
 *    1. Select data access 'Mdx Query on SampleData - Jndi'
 *    2. Order by Year
 *    3. Order by Price
 *    4. Order by PriceInk
 *    5. Search existence content
 *    6. Search inexistance content
 */
@Test
public void tc2_SelectDataAccess_DisplayDataForSelectedDataAccess() {
    this.log.info("tc2_SelectDataAccess_DisplayDataForSelectedDataAccess");

    /*
     * ## Step 1
     */
    Select select = new Select(this.elemHelper.FindElement(driver, By.id("dataAccessSelector")));
    select.selectByVisibleText("Mdx Query on SampleData - Jndi");
    //wait to render page
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    //Check the presented contains
    WebElement elemStatus = this.elemHelper.FindElement(driver, By.id("status"));
    assertEquals("Shipped", elemStatus.getAttribute("value"));
    //Check we have three elements and no more than that
    String textPaging = this.elemHelper.WaitForElementPresentGetText(driver, By.id("contents_info"));
    assertEquals("View 1 to 3 of 3 elements", textPaging);
    //Column Time
    String columnOneRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td"));
    String columnOneRowTwo = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[2]/td"));
    String columnOneRowThree = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[3]/td"));
    assertEquals("All Years", columnOneRowOne);
    assertEquals("All Years", columnOneRowTwo);
    assertEquals("All Years", columnOneRowThree);
    //Column Year
    String columnTwoRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td[2]"));
    String columnTwoRowTwo = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[2]/td[2]"));
    String columnTwoRowThree = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[3]/td[2]"));
    assertEquals("2003", columnTwoRowOne);
    assertEquals("2004", columnTwoRowTwo);
    assertEquals("2005", columnTwoRowThree);
    //Column Price
    String columnThreeRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td[3]"));
    String columnThreeRowTwo = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[2]/td[3]"));
    String columnThreeRowThree = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[3]/td[3]"));
    assertEquals("3573701.2500000023", columnThreeRowOne);
    assertEquals("4750205.889999998", columnThreeRowTwo);
    assertEquals("1513074.4600000002", columnThreeRowThree);
    //Column PriceInk
    String columnFourRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td[4]"));
    String columnFourRowTwo = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[2]/td[4]"));
    String columnFourRowThree = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[3]/td[4]"));
    assertEquals("3.5737012500000023", columnFourRowOne);
    assertEquals("4.750205889999998", columnFourRowTwo);
    assertEquals("1.5130744600000001", columnFourRowThree);

    /*
     * ## Step 2
     */
    //Click Asc
    this.elemHelper.ClickJS(driver, By.xpath("//table[@id='contents']/thead/tr/th[2]"));
    //Click Desc
    this.elemHelper.ClickJS(driver, By.xpath("//table[@id='contents']/thead/tr/th[2]"));
    //Column Time
    columnOneRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td"));
    columnOneRowTwo = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[2]/td"));
    columnOneRowThree = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[3]/td"));
    assertEquals("All Years", columnOneRowOne);
    assertEquals("All Years", columnOneRowTwo);
    assertEquals("All Years", columnOneRowThree);
    //Column Year
    columnTwoRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td[2]"));
    columnTwoRowTwo = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[2]/td[2]"));
    columnTwoRowThree = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[3]/td[2]"));
    assertEquals("2005", columnTwoRowOne);
    assertEquals("2004", columnTwoRowTwo);
    assertEquals("2003", columnTwoRowThree);
    //Column Price
    columnThreeRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td[3]"));
    columnThreeRowTwo = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[2]/td[3]"));
    columnThreeRowThree = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[3]/td[3]"));
    assertEquals("1513074.4600000002", columnThreeRowOne);
    assertEquals("4750205.889999998", columnThreeRowTwo);
    assertEquals("3573701.2500000023", columnThreeRowThree);
    //Column PriceInk
    columnFourRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td[4]"));
    columnFourRowTwo = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[2]/td[4]"));
    columnFourRowThree = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[3]/td[4]"));
    assertEquals("1.5130744600000001", columnFourRowOne);
    assertEquals("4.750205889999998", columnFourRowTwo);
    assertEquals("3.5737012500000023", columnFourRowThree);

    /*
     * ## Step 3
     */
    //Click Asc
    this.elemHelper.ClickJS(driver, By.xpath("//table[@id='contents']/thead/tr/th[3]"));
    //Click Desc
    this.elemHelper.ClickJS(driver, By.xpath("//table[@id='contents']/thead/tr/th[3]"));
    //Column Time
    columnOneRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td"));
    columnOneRowTwo = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[2]/td"));
    columnOneRowThree = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[3]/td"));
    assertEquals("All Years", columnOneRowOne);
    assertEquals("All Years", columnOneRowTwo);
    assertEquals("All Years", columnOneRowThree);
    //Column Year
    columnTwoRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td[2]"));
    columnTwoRowTwo = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[2]/td[2]"));
    columnTwoRowThree = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[3]/td[2]"));
    assertEquals("2004", columnTwoRowOne);
    assertEquals("2003", columnTwoRowTwo);
    assertEquals("2005", columnTwoRowThree);
    //Column Price
    columnThreeRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td[3]"));
    columnThreeRowTwo = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[2]/td[3]"));
    columnThreeRowThree = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[3]/td[3]"));
    assertEquals("4750205.889999998", columnThreeRowOne);
    assertEquals("3573701.2500000023", columnThreeRowTwo);
    assertEquals("1513074.4600000002", columnThreeRowThree);
    //Column PriceInk
    columnFourRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td[4]"));
    columnFourRowTwo = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[2]/td[4]"));
    columnFourRowThree = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[3]/td[4]"));
    assertEquals("4.750205889999998", columnFourRowOne);
    assertEquals("3.5737012500000023", columnFourRowTwo);
    assertEquals("1.5130744600000001", columnFourRowThree);

    /*
     * ## Step 4
     */
    //Click Asc
    this.elemHelper.ClickJS(driver, By.xpath("//table[@id='contents']/thead/tr/th[4]"));
    //Click Desc
    this.elemHelper.ClickJS(driver, By.xpath("//table[@id='contents']/thead/tr/th[4]"));
    //Column Time
    columnOneRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td"));
    columnOneRowTwo = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[2]/td"));
    columnOneRowThree = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[3]/td"));
    assertEquals("All Years", columnOneRowOne);
    assertEquals("All Years", columnOneRowTwo);
    assertEquals("All Years", columnOneRowThree);
    //Column Year
    columnTwoRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td[2]"));
    columnTwoRowTwo = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[2]/td[2]"));
    columnTwoRowThree = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[3]/td[2]"));
    assertEquals("2004", columnTwoRowOne);
    assertEquals("2003", columnTwoRowTwo);
    assertEquals("2005", columnTwoRowThree);
    //Column Price
    columnThreeRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td[3]"));
    columnThreeRowTwo = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[2]/td[3]"));
    columnThreeRowThree = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[3]/td[3]"));
    assertEquals("4750205.889999998", columnThreeRowOne);
    assertEquals("3573701.2500000023", columnThreeRowTwo);
    assertEquals("1513074.4600000002", columnThreeRowThree);
    //Column PriceInk
    columnFourRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td[4]"));
    columnFourRowTwo = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[2]/td[4]"));
    columnFourRowThree = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr[3]/td[4]"));
    assertEquals("4.750205889999998", columnFourRowOne);
    assertEquals("3.5737012500000023", columnFourRowTwo);
    assertEquals("1.5130744600000001", columnFourRowThree);

    /*
     * ## Step 5
     */
    this.elemHelper.FindElement(driver, By.cssSelector("#contents_filter input")).clear();
    this.elemHelper.FindElement(driver, By.cssSelector("#contents_filter input")).sendKeys("2004");
    //Check we have only one element
    textPaging = this.elemHelper.WaitForElementPresentGetText(driver, By.id("contents_info"));
    assertEquals("View 1 to 1 of 1 elements (filter 3 elements)", textPaging);
    //Column Time
    columnOneRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td"));
    assertEquals("All Years", columnOneRowOne);
    //Column Year
    columnTwoRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td[2]"));
    assertEquals("2004", columnTwoRowOne);
    //Column Price
    columnThreeRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td[3]"));
    assertEquals("4750205.889999998", columnThreeRowOne);
    //Column PriceInk
    columnFourRowOne = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td[4]"));
    assertEquals("4.750205889999998", columnFourRowOne);

    /*
     * ## Step 6
     */
    this.elemHelper.FindElement(driver, By.cssSelector("#contents_filter input")).clear();
    this.elemHelper.FindElement(driver, By.cssSelector("#contents_filter input")).sendKeys("Merry");
    //Check we have only one element
    textPaging = this.elemHelper.WaitForElementPresentGetText(driver, By.id("contents_info"));
    assertEquals("empty (filter 3 elements)", textPaging);
    //Check if table is empty
    String textNoResult = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//table[@id='contents']/tbody/tr/td"));
    assertEquals("No results.", textNoResult);

    //Clean data
    this.elemHelper.FindElement(driver, By.cssSelector("#contents_filter input")).clear();
    this.elemHelper.FindElement(driver, By.cssSelector("#contents_filter input")).sendKeys(Keys.RETURN);
    //Order by Year
    this.elemHelper.ClickJS(driver, By.xpath("//table[@id='contents']/thead/tr/th[2]"));
    //Order by Time
    this.elemHelper.ClickJS(driver, By.xpath("//table[@id='contents']/thead/tr/th[1]"));
}

From source file:com.thoughtworks.selenium.webdriven.commands.TypeKeys.java

License:Apache License

@Override
protected Void handleSeleneseCommand(WebDriver driver, String locator, String value) {
    alertOverride.replaceAlertMethod(driver);

    value = value.replace("\\10", Keys.ENTER);
    value = value.replace("\\13", Keys.RETURN);
    value = value.replace("\\27", Keys.ESCAPE);
    value = value.replace("\\38", Keys.ARROW_UP);
    value = value.replace("\\40", Keys.ARROW_DOWN);
    value = value.replace("\\37", Keys.ARROW_LEFT);
    value = value.replace("\\39", Keys.ARROW_RIGHT);

    finder.findElement(driver, locator).sendKeys(value);

    return null;// w ww  .j  ava  2s  .c  om
}

From source file:com.thoughtworks.selenium.webdriven.commands.TypeKeysTest.java

License:Apache License

@Test
public void substitutesReturnAndEscapeKeys() {
    String expected = newString(Keys.ENTER, Keys.RETURN, Keys.ESCAPE);
    String input = "\\10\\13\\27";

    new TypeKeys(new AlertOverrideStub(), elementFinder).apply(null, new String[] { "foo", input });

    verify(element).sendKeys(expected);/*from  w w  w .j ava  2 s  .  c o m*/
}

From source file:Data.Database.java

public void addTeams() throws InterruptedException, FileNotFoundException {
    Scanner fileScanner = new Scanner(new File("login.txt"));
    String username = fileScanner.nextLine();
    String password = fileScanner.nextLine();

    WebDriver firefoxDriver = new FirefoxDriver();

    //Open the url which we want in firefox
    firefoxDriver.get("http://www.fantrax.com/fantasy/teamRosterChart.go?leagueId=ntokropui8nbbjt1");
    WebElement link;//from   w  ww  .jav a 2s.c om
    link = firefoxDriver.findElement(By.id("loginZone"));
    link.click();
    WebElement input;
    input = firefoxDriver.findElement(By.id("j_username"));
    input.sendKeys(username);
    input = firefoxDriver.findElement(By.id("realPassword"));
    input.sendKeys(password);
    input.sendKeys(Keys.RETURN);

    Thread.sleep(2000);
    firefoxDriver.get("http://www.fantrax.com/fantasy/teamRosterChart.go?leagueId=ntokropui8nbbjt1");
    String data = firefoxDriver.getPageSource();

    data = data.substring(data.indexOf("<table class=\"fantTable rosterChart\">"));
    data = data.substring(0, data.indexOf("</tbody>"));
    String[] temp = data.split("<td class=\"team leftCol\">");
    //System.out.println(temp[1]);

    for (int i = 1; i < temp.length; i++) {
        Team t = new Team();
        t.fillTeam(years, lookup, temp[i]);
        fh_teams.add(t);
        t.getTotals();
        t.printAverages();
    }

    firefoxDriver.quit();
}

From source file:de.iteratec.iteraplan.webtests.poc.page.attributes.AttributesNewElement2Page.java

License:Open Source License

/**
 * Adds responsiblities to an attribute//from  ww  w .  j  av a  2  s .  c  o  m
 * @param resp list of responsibilities
 * @return the attributesNewElement2Page
 */
public AttributesNewElement2Page addResponsibilities(List<String> resp) {

    int counter = 1;

    for (String str : resp) {

        String respTextXPath = "//*[@id=\"componentModel.responsibilityAttributeValuesModel.htmlId_table\"]/tbody/tr["
                + counter + "]/td[2]/input";
        By respTextLocator = By.xpath(respTextXPath);

        driver.findElement(respTextLocator).click();
        driver.findElement(respTextLocator).sendKeys(str);

        /*
         * The usage of the wait construct is bad. This should be replaced private By conditional waiting. It is used at this place,
         * because the popup list must be loaded from the server and after THAT an entry can be selected
         * will be fixed soon (hopefully) 
         */

        WaitUtils.wait(2000);

        driver.findElement(respTextLocator).sendKeys(Keys.ARROW_DOWN);
        driver.findElement(respTextLocator).sendKeys(Keys.RETURN);

        WaitUtils.wait(2000);

        clickAddResponsibility();

        counter++;

    }

    return this;

}

From source file:de.iteratec.iteraplan.webtests.poc.page.attributes.AttributesOverviewPage.java

License:Open Source License

/**
 * Sets the result size to the given enum value
 * @param result size of list/*  w  w  w .  j  av a  2 s  .c om*/
 */
public void setPageResult(ResultSize result) {

    switch (result) {

    case TEN:
        driver.findElement(comboPageSizeLocator).sendKeys("1");
        break;
    case TWENTY:
        driver.findElement(comboPageSizeLocator).sendKeys("2");
        break;
    case FIFTY:
        driver.findElement(comboPageSizeLocator).sendKeys("5");
        break;
    case ALL:
        driver.findElement(comboPageSizeLocator).sendKeys("a");
        break;
    default:
        break;

    }

    driver.findElement(comboPageSizeLocator).sendKeys(Keys.RETURN);
}