Example usage for org.openqa.selenium Keys ENTER

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

Introduction

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

Prototype

Keys ENTER

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

Click Source Link

Usage

From source file:com.hotwire.selenium.tools.c3.customer.C3SearchPartnerPage.java

License:Open Source License

public void searchForItinerary(String itin) {
    WebElement itineraryInput = findOne("input[name='partnerConfirmationNumber']", EXTRA_WAIT);
    itineraryInput.sendKeys(itin);/*from   w  w w .  j  av a2  s.c  o m*/
    findOne("img[name='confirmationNumberGif']", DEFAULT_WAIT);
    itineraryInput.sendKeys(Keys.ENTER);
}

From source file:com.hotwire.selenium.tools.c3.customer.editAccountInfo.C3EditAccInfoPage.java

License:Open Source License

public void clickSubmit() {
    findOne("input[name='countryPhone']").sendKeys(Keys.ENTER);
}

From source file:com.java.AppTestType_18_11_2015.java

public void SEARCHRESULTS(WebDriver driver, String fieldText, String value) {

    driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
    String fieldType = fieldText;
    String field = fieldText;// w w w  . j a v a2 s . c  o  m
    try {
        AppKeyWords SER = AppKeyWords.valueOf(fieldType.toUpperCase());

        switch (SER) {

        case AGRI:

            driver.findElement(By.linkText("AGRICULTURE")).click();
            //suman
            Thread.sleep(3000);
            boolean b = SEARCH_RESULT_COMPARISON(driver);
            System.out.println(b);
            if (b) {

                resultDetails.setFlag(true);
                System.out.println("Counts matched!");
            } else
                resultDetails.setFlag(false);

            break;

        case TRANS:

            driver.findElement(By.xpath("(//a[text()='Transportation'])")).click();

            Thread.sleep(3000);
            boolean b2 = SEARCH_RESULT_COMPARISON(driver);
            System.out.println(b2);
            if (b2) {

                resultDetails.setFlag(true);
                System.out.println("Counts matched!");
            } else
                resultDetails.setFlag(false);

            break;

        case CONS:

            driver.findElement(By.xpath("//a[text()='Construction']")).click();
            Thread.sleep(3000);
            boolean b3 = SEARCH_RESULT_COMPARISON(driver);
            System.out.println(b3);
            if (b3) {

                resultDetails.setFlag(true);
                System.out.println("Counts matched!");
            } else
                resultDetails.setFlag(false);

            break;

        case ENER:

            try {
                driver.findElement(By.xpath("(//a[contains(text(),'Energy')])[4]")).click();
            } catch (Exception e) {
                driver.findElement(By.xpath("http://e1.dev.assetnation.com/energy-equipment")).click();
            }

            Thread.sleep(3000);
            boolean b4 = SEARCH_RESULT_COMPARISON(driver);
            System.out.println(b4);
            if (b4) {

                resultDetails.setFlag(true);
                System.out.println("Counts matched!");
            } else
                resultDetails.setFlag(false);

            break;

        case SEARCH:
            try {
                driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
                driver.findElement(By.id("search")).sendKeys("trucks");
                Thread.sleep(1500);
                //driver.findElement(By.xpath("//[@id='main_search']/button")).click();
                driver.findElement(By.id("search")).sendKeys(Keys.ENTER);
                Thread.sleep(3000);
                boolean b5 = SEARCH_RESULT_COMPARISON(driver);
                System.out.println(b5);
                if (b5) {

                    resultDetails.setFlag(true);
                    System.out.println("Counts matched!");
                } else
                    resultDetails.setFlag(false);
            } catch (Exception e) {
                resultDetails.setFlag(false);
                e.printStackTrace();
            }

            break;

        }
    } catch (Exception e) {
        //System.out.println(e);
        e.printStackTrace();
        resultDetails.setFlag(false);
    }
}

From source file:com.lazerycode.ebselen.codegenerators.ActionsGeneratorTest.java

License:Apache License

@Test
public void generateCodeActionKeyDown() throws Exception {
    assertThat(this.action.builder().keyDown(Keys.ENTER), is(equalTo("builder.keyDown(Keys.ENTER)")));
}

From source file:com.lazerycode.ebselen.codegenerators.ActionsGeneratorTest.java

License:Apache License

@Test
public void generateCodeActionKeyDownAtElement() throws Exception {
    assertThat(this.action.builder().keyDown(webElement, Keys.ENTER),
            is(equalTo("builder.keyDown(driver.findElement(By.xpath(\"//div[@id='bar']\")), Keys.ENTER)")));
}

From source file:com.lazerycode.ebselen.codegenerators.ActionsGeneratorTest.java

License:Apache License

@Test
public void generateCodeActionKeyUp() throws Exception {
    assertThat(this.action.builder().keyUp(Keys.ENTER), is(equalTo("builder.keyUp(Keys.ENTER)")));
}

From source file:com.lazerycode.ebselen.codegenerators.ActionsGeneratorTest.java

License:Apache License

@Test
public void generateCodeActionKeyUpAtElement() throws Exception {
    assertThat(this.action.builder().keyUp(webElement, Keys.ENTER),
            is(equalTo("builder.keyUp(driver.findElement(By.xpath(\"//div[@id='bar']\")), Keys.ENTER)")));
}

From source file:com.liferay.faces.test.alloy.issue.FACES_3274Tester.java

License:Open Source License

/**
 * This method only works in Firefox.//from w  w w.  j av a  2s .  c  om
 */
private static void runFACES_3274Test(BrowserDriver browserDriver, WaitingAsserter waitingAsserter,
        String inputXpath, boolean isAutocompleteOn) {

    String helloWorld = "Hello World!";
    Actions actions = browserDriver.createActions(inputXpath);
    WebElement inputElement = browserDriver.findElementByXpath(inputXpath);
    actions.sendKeys(inputElement, helloWorld, Keys.ENTER);
    browserDriver.performAndWaitForRerender(actions.build(), inputXpath);
    browserDriver.clearElement(inputXpath);

    String hello = "Hello";
    browserDriver.sendKeysToElement(inputXpath, hello);
    waitingAsserter.assertTextPresentInElementValue(hello, inputXpath);
    browserDriver.sendKeysToElement(inputXpath, Keys.DOWN, Keys.ENTER);
    waitingAsserter.assertTextPresentInElementValue(hello, inputXpath);

    ExpectedCondition<Boolean> textToBePresentInElementValue = ExpectedConditions
            .textToBePresentInElementValue(By.xpath(inputXpath), helloWorld);

    if (isAutocompleteOn) {
        waitingAsserter.assertTrue(textToBePresentInElementValue);
    } else {
        waitingAsserter.assertFalse(textToBePresentInElementValue);
    }
}

From source file:com.lox.webdriver.page.DatasetCreationPage.java

public DatasetCreationPage createDataSet() {

    datasetTitleField.sendKeys(TEST_DATASET1);
    datasetTitleField.sendKeys(Keys.ENTER);

    driver.findElement(By.xpath("./*//*[@id='field-name']")).sendKeys(TEST_DATASET1);

    datasetDescriptionField.sendKeys(TEST_DATASET1_DESCRIPTION);
    //datasetTagsField.sendKeys(TEST_DATASET1_TAGS);
    //datasetTagsField.sendKeys(Keys.ENTER);

    selectDropdownValue(By.xpath(".//*[@id='s2id_field-license']/a"), "Other (Open)");

    nextAddDataButton.click();/*from w ww . j a va2  s.  com*/

    return this;
}

From source file:com.moodle.testmanager.pageObjectModel.DatabasesFields.java

License:GNU General Public License

/**
 * Enters a single value for the options text area then hits the enter key to start a new line.
 * re-use for each option to be entered. 
 * @param option The value for the option that you want to enter.
 *//* w w w . j av a 2 s  .  c o m*/
public void enterOption(String option) {
    WebElement field = driver
            .findElement(By.xpath(".//tr[contains(.,'" + this.properties.get("options") + "')]/td/textarea"));
    field.sendKeys(option, Keys.ENTER);
}