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:org.zanata.page.groups.VersionGroupPage.java

License:Open Source License

public VersionGroupPage confirmAddProject() {
    new Actions(getDriver()).sendKeys(Keys.ENTER);
    return new VersionGroupPage(getDriver());
}

From source file:org.zanata.page.webtrans.EditorPage.java

License:Open Source License

public EditorPage inputFilterQuery(String query) {
    log.info("Enter filter query {}", query);
    readyElement(editorFilterField).clear();
    enterText(readyElement(editorFilterField), query + Keys.ENTER, true, false, false);
    return new EditorPage(getDriver());
}

From source file:pageObjects.tms.TmsHomePage.java

public void clickOnGo() throws Exception {
    try {//w ww . j  av  a 2 s  .  c o  m
        webDriver.waitForElement("Submit222223", ByTypes.name).sendKeys(Keys.ENTER);

    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:pawl.jbehave.step.BrowserSteps.java

License:Apache License

/**
 * Action for press ENTER key./*from  ww  w  .  j  a v a 2s  .c  om*/
 *
 * @param identity element identity for search
 */
@When("I press ENTER on '$identity'")
@Alias("press ENTER on '$identity'")
public void pressEnter(final String identity) {
    browser.base().find(identity).sendKeys(Keys.ENTER);
}

From source file:print.SLNonDomesticTest.java

@Test(groups = { "regression" })
public void _APO_Test() {
    boolean pass = true;
    testHelper.beginTest();/*from   w w  w .j a  v a  2s. c  o m*/
    try {
        printHelper.getWebPostagePage().ensureUserIsSignedIn();
        // test parameters
        String sendToStreetNumberAndName = "Unit 15324";
        String sendToCityStateZip = "APO, AP 96205-5324";
        String addressStr = sendToInfo + Keys.ENTER + sendToStreetNumberAndName + Keys.ENTER
                + sendToCityStateZip;

        ShippingLabelBean paramBean = new ShippingLabelBean();
        paramBean.setPrintOn(PrintOnEnum.SHIPPING_LABEL_8X11.toString());
        paramBean.setShippingLabelService(SLServiceEnum.PM_PACKAGE.toString());
        paramBean.setPrintOnPaperSide(SLPrintOnSideEnum.RIGHT.toString());
        paramBean.setRecipientInfo(sendToInfo);
        paramBean.setAddress(addressStr);
        paramBean.setPounds(0);
        // total ounces needs to add up with each add item ounces.
        paramBean.setOunces(2);
        //paramBean.setTracking(ShippingLabelTracking.USPS_TRACKING.toString());
        // paramBean.setStampsInsuranceAmount(150);
        paramBean.setCheckHidePostageValue(false);
        paramBean.setPrintReceiptCheckbox(true);
        paramBean.setPrintReferenceNumberCheckbox(true);
        paramBean.setReferenceNumber(testHelper.getTestName());

        CustomsInformationBean customsInformationBean = new CustomsInformationBean();
        customsInformationBean.setPackageContents(PackageContents.COMMERCIAL_SAMPLE.toString());
        customsInformationBean.setLicenseNumber("LIC12345");
        customsInformationBean.setCertificateNumber("CERT12345");
        customsInformationBean.setInvoiceNumber("INV123455");
        customsInformationBean.setMoreInfo(sendToInfo);
        customsInformationBean.setiAgreeToTheUSPSPrivacyActStatement(true);

        CustomsAddItemBean addItemBean = new CustomsAddItemBean();
        addItemBean.setDescription(sendToInfo);
        addItemBean.setPounds(0);
        addItemBean.setOunces(1);
        addItemBean.setQuantity(1);
        addItemBean.setValue(1);
        addItemBean.setHsTariff("US Tariff");

        CustomsAddItemBean addItemBean2 = new CustomsAddItemBean();
        addItemBean2.setDescription(sendToInfo);
        addItemBean2.setPounds(0);
        addItemBean2.setOunces(1);
        addItemBean2.setQuantity(1);
        addItemBean2.setValue(1);
        addItemBean2.setHsTariff("US Tariff");

        printHelper.setShippingLabelForm(paramBean, customsInformationBean, addItemBean, addItemBean2);

        printHelper.printPostage(paramBean);

    } catch (Exception e) {
        testHelper.logErrorTagStart();
        errorMessage = e.getMessage();
        pass = false;
        testHelper.logError(errorMessage);
        captureScreenShot(String.format("%s_FAIL_%s", testHelper.getTestName(), errorMessage));
        e.printStackTrace();
        testHelper.logErrorTagEnd();
    }

    //set delivery country back to US
    try {
        ShippingLabelModule printForm = printHelper.getWebPostagePage().getPrintModule().printOn()
                .shippingLabel8x11();
        printForm.setShipToCountry(CountryEnum.UNITED_STATES);
    } catch (Exception e) {
        //do nothing...
    }

    Assert.assertTrue(pass, String.format("%s: %s ", testHelper.getTestName(), errorMessage));
    testHelper.endTest();
}

From source file:print.SLNonDomesticTest.java

@Test(groups = { "regression" })
public void _DPO_Test() {
    boolean pass = true;
    testHelper.beginTest();/*  w w  w  .  j a  v  a  2 s . c om*/
    try {
        printHelper.getWebPostagePage().ensureUserIsSignedIn();
        // test parameters
        String sendToStreetNumberAndName = "Unit 8400, Box 0000";
        String sendToCityStateZip = "DPO AE 09498-9997";
        String addressStr = sendToInfo + Keys.ENTER + sendToStreetNumberAndName + Keys.ENTER
                + sendToCityStateZip;

        ShippingLabelBean paramBean = new ShippingLabelBean();
        paramBean.setPrintOn(PrintOnEnum.SHIPPING_LABEL_8X11.toString());
        paramBean.setShippingLabelService(SLServiceEnum.PM_PACKAGE.toString());
        paramBean.setPrintOnPaperSide(SLPrintOnSideEnum.RIGHT.toString());
        paramBean.setRecipientInfo(sendToInfo);
        paramBean.setAddress(addressStr);
        paramBean.setPounds(0);
        paramBean.setOunces(1);
        //paramBean.setTracking(ShippingLabelTracking.USPS_TRACKING.toString());
        // paramBean.setStampsInsuranceAmount(150);
        paramBean.setCheckHidePostageValue(false);
        paramBean.setPrintReceiptCheckbox(true);
        paramBean.setPrintReferenceNumberCheckbox(true);
        paramBean.setReferenceNumber(testHelper.getTestName());

        CustomsInformationBean customsInformationBean = new CustomsInformationBean();
        customsInformationBean.setPackageContents(PackageContents.MERCHANDISE.toString());
        customsInformationBean.setMoreInfo(sendToInfo);
        customsInformationBean.setiAgreeToTheUSPSPrivacyActStatement(true);

        CustomsAddItemBean addItemBean = new CustomsAddItemBean();
        addItemBean.setDescription(sendToInfo);
        addItemBean.setPounds(0);
        addItemBean.setOunces(1);
        addItemBean.setQuantity(1);
        addItemBean.setValue(1);
        addItemBean.setHsTariff("US Tariff");

        printHelper.setShippingLabelForm(paramBean, customsInformationBean, addItemBean);

        printHelper.printPostage(paramBean);

    } catch (Exception e) {
        testHelper.logErrorTagStart();
        errorMessage = e.getMessage();
        pass = false;
        testHelper.logError(errorMessage);
        captureScreenShot(String.format("%s_FAIL_%s", testHelper.getTestName(), errorMessage));
        e.printStackTrace();
        testHelper.logErrorTagEnd();
    }

    //set delivery country back to US
    try {
        ShippingLabelModule printForm = printHelper.getWebPostagePage().getPrintModule().printOn()
                .shippingLabel8x11();
        printForm.setShipToCountry(CountryEnum.UNITED_STATES);
    } catch (Exception e) {
        //do nothing...
    }

    Assert.assertTrue(pass, String.format("%s: %s ", testHelper.getTestName(), errorMessage));
    testHelper.endTest();
}

From source file:print.SLNonDomesticTest.java

@Test(groups = { "regression" })
public void _FPO_Test() {
    boolean pass = true;
    testHelper.beginTest();//from  w w w .  java2  s .  co  m
    try {
        printHelper.getWebPostagePage().ensureUserIsSignedIn();
        // test parameters
        String sendToStreetNumberAndName = "USS Mason";
        String sendToCityStateZip = "FPO, AE 09578-1302";
        String addressStr = sendToInfo + Keys.ENTER + sendToStreetNumberAndName + Keys.ENTER
                + sendToCityStateZip;

        ShippingLabelBean paramBean = new ShippingLabelBean();
        paramBean.setPrintOn(PrintOnEnum.SHIPPING_LABEL_8X11.toString());
        paramBean.setShippingLabelService(SLServiceEnum.PME_FLAT_RATE_ENVELOPE.toString());
        paramBean.setPrintOnPaperSide(SLPrintOnSideEnum.RIGHT.toString());
        paramBean.setRecipientInfo(sendToInfo);
        paramBean.setAddress(addressStr);
        paramBean.setPounds(0);
        paramBean.setOunces(1);
        //paramBean.setTracking(ShippingLabelTracking.USPS_TRACKING.toString());
        // paramBean.setStampsInsuranceAmount(150);
        paramBean.setCheckHidePostageValue(false);
        paramBean.setPrintReceiptCheckbox(true);
        paramBean.setPrintReferenceNumberCheckbox(true);
        paramBean.setReferenceNumber(testHelper.getTestName());

        CustomsInformationBean customsInformationBean = new CustomsInformationBean();
        customsInformationBean.setPackageContents(PackageContents.OTHER.toString());
        customsInformationBean.setMoreInfo(sendToInfo);
        customsInformationBean.setiAgreeToTheUSPSPrivacyActStatement(true);

        CustomsAddItemBean addItemBean = new CustomsAddItemBean();
        addItemBean.setDescription(sendToInfo);
        addItemBean.setPounds(0);
        addItemBean.setOunces(1);
        addItemBean.setQuantity(1);
        addItemBean.setValue(1);
        addItemBean.setHsTariff("US Tariff");

        printHelper.setShippingLabelForm(paramBean, customsInformationBean, addItemBean);

        printHelper.printPostage(paramBean);

    } catch (Exception e) {
        testHelper.logErrorTagStart();
        errorMessage = e.getMessage();
        pass = false;
        testHelper.logError(errorMessage);
        captureScreenShot(String.format("%s_FAIL_%s", testHelper.getTestName(), errorMessage));
        e.printStackTrace();
        testHelper.logErrorTagEnd();
    }

    //set delivery country back to US
    try {
        ShippingLabelModule printForm = printHelper.getWebPostagePage().getPrintModule().printOn()
                .shippingLabel8x11();
        printForm.setShipToCountry(CountryEnum.UNITED_STATES);
    } catch (Exception e) {
        //do nothing...
    }

    Assert.assertTrue(pass, String.format("%s: %s ", testHelper.getTestName(), errorMessage));
    testHelper.endTest();
}

From source file:print.SLNonDomesticTest.java

@Test(groups = { "regression" })
public void _FAST_Test() {
    boolean pass = true;
    testHelper.beginTest();//from   w  w  w  .j  av a2s  .  c om
    try {
        printHelper.getWebPostagePage().ensureUserIsSignedIn();
        // test parameters
        String sendToStreetNumberAndName = "800 Pale San Vitores Road";
        String sendToCityStateZip = "Tumon, Guam 96913";
        String addressStr = sendToInfo + Keys.ENTER + sendToStreetNumberAndName + Keys.ENTER
                + sendToCityStateZip;

        ShippingLabelBean paramBean = new ShippingLabelBean();
        paramBean.setPrintOn(PrintOnEnum.SHIPPING_LABEL_8X11.toString());
        paramBean.setShippingLabelService(SLServiceEnum.PM_PACKAGE.toString());
        paramBean.setPrintOnPaperSide(SLPrintOnSideEnum.RIGHT.toString());
        paramBean.setRecipientInfo(sendToInfo);
        paramBean.setAddress(addressStr);
        paramBean.setPounds(0);
        paramBean.setOunces(3);
        //paramBean.setTracking(ShippingLabelTracking.USPS_TRACKING.toString());
        // paramBean.setStampsInsuranceAmount(150);
        paramBean.setCheckHidePostageValue(false);
        paramBean.setPrintReceiptCheckbox(true);
        paramBean.setPrintReferenceNumberCheckbox(true);
        paramBean.setReferenceNumber(testHelper.getTestName());

        CustomsInformationBean customsInformationBean = new CustomsInformationBean();
        customsInformationBean.setPackageContents(PackageContents.GIFTS.toString());
        customsInformationBean.setMoreInfo(sendToInfo);
        customsInformationBean.setiAgreeToTheUSPSPrivacyActStatement(true);

        CustomsAddItemBean addItemBean1 = new CustomsAddItemBean();
        addItemBean1.setDescription("First Item");
        addItemBean1.setPounds(0);
        addItemBean1.setOunces(1);
        addItemBean1.setQuantity(1);
        addItemBean1.setValue(1);
        addItemBean1.setHsTariff("US Tariff");

        CustomsAddItemBean addItemBean2 = new CustomsAddItemBean();
        addItemBean2.setDescription("Second Item");
        addItemBean2.setPounds(0);
        addItemBean2.setOunces(1);
        addItemBean2.setQuantity(1);
        addItemBean2.setValue(1);
        addItemBean2.setHsTariff("US Tariff");

        CustomsAddItemBean addItemBean3 = new CustomsAddItemBean();
        addItemBean3.setDescription("Third Item");
        addItemBean3.setPounds(0);
        addItemBean3.setOunces(1);
        addItemBean3.setQuantity(1);
        addItemBean3.setValue(1);
        addItemBean3.setHsTariff("US Tariff");

        printHelper.setShippingLabelForm(paramBean, customsInformationBean, addItemBean1, addItemBean2,
                addItemBean3);

        printHelper.printPostage(paramBean);

    } catch (Exception e) {
        testHelper.logErrorTagStart();
        errorMessage = e.getMessage();
        pass = false;
        testHelper.logError(errorMessage);
        captureScreenShot(String.format("%s_FAIL_%s", testHelper.getTestName(), errorMessage));
        e.printStackTrace();
        testHelper.logErrorTagEnd();
    }

    //set delivery country back to US
    try {
        ShippingLabelModule printForm = printHelper.getWebPostagePage().getPrintModule().printOn()
                .shippingLabel8x11();
        printForm.setShipToCountry(CountryEnum.UNITED_STATES);
    } catch (Exception e) {
        //do nothing...
    }

    Assert.assertTrue(pass, String.format("%s: %s ", testHelper.getTestName(), errorMessage));
    testHelper.endTest();
}

From source file:redhat.che.functional.tests.fragments.Terminal.java

License:Open Source License

/**
 * Executes command in terminal//from w w  w .j av a2  s  .  c  om
 * 
 * @param command
 *            command to execute
 */
public void executeCommands(String command) {
    ActionUtils.writeIntoElement(driver, xterm, command);
    xterm.sendKeys(Keys.ENTER);
}

From source file:renascere.Renascere.java

License:Open Source License

/**
 * @Description Method that send an ACTION to a selected object
 *//*  w  w  w. j  ava  2  s. c o m*/
public static void performAction(tAction uiAction, String sValue, WebDriver driver, WebElement wElement) {
    try {
        Actions actions = new Actions(driver);
        actions.moveToElement(wElement);
        actions.click();
        pauseExecution(Global.fTimeQSecond);
        switch (uiAction) {
        case ENTER:
            actions.sendKeys(sValue);
            actions.build().perform();
            break;
        case SELECT:
            actions.sendKeys(sValue);
            actions.build().perform();
            pauseExecution(Global.fTimeQSecond);
            actions.sendKeys(Keys.ENTER);
            actions.build().perform();
            break;
        case CHOOSE:
            actions.sendKeys(sValue);
            actions.sendKeys(Keys.ENTER);
            actions.build().perform();
            pauseExecution(Global.fTimeQSecond);
            break;
        default:
            break;
        }
        return;
    } catch (Exception e) {
        frmError("performing action " + uiAction + " with: " + sValue, e.getMessage(), severity.HIGH);
    }
}