Example usage for org.openqa.selenium Keys ARROW_DOWN

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

Introduction

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

Prototype

Keys ARROW_DOWN

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

Click Source Link

Usage

From source file:be.rubus.web.testing.widget.extension.angularprime.PuiInput.java

License:Apache License

public void sendDownArrowFromKeyboard() {
    root.sendKeys(Keys.ARROW_DOWN);
}

From source file:browsermator.com.DownArrowKeyAction.java

@Override
public void RunAction(WebDriver driver) {
    try {/*from w ww . j av  a 2s  . com*/
        WebElement element = driver.switchTo().activeElement();
        element.sendKeys(Keys.ARROW_DOWN);

        this.Pass = true;
    } catch (Exception ex) {
        this.Pass = false;
    }
}

From source file:cc.kune.selenium.login.ScreenCastsViaSeleniumTests.java

License:GNU Affero Public License

/**
 * Global screencast./*from   w  ww.  j av  a 2  s.  c  o m*/
 * 
 * @param shortNameUntrans
 *          the short name untrans
 * @param longNameUntrans
 *          the long name untrans
 * @param passwd
 *          the passwd
 * @param emailUntrans
 *          the email untrans
 */
@Test(dataProvider = "correctregister")
public void globalScreencast(final String shortNameUntrans, final String longNameUntrans, final String passwd,
        final String emailUntrans) {
    final String shortName = t(shortNameUntrans);
    final String longName = t(longNameUntrans);
    final String email = t(emailUntrans);
    final String buddy = "luther";
    SeleniumUtils.fastSpeed(false);
    // 15 chars, the limit, so we don't use shortName
    final String sufix = getTempString();
    showTitleSlide(t("User registration"), t("to get full access to this site tools/contents"));
    login.createOne();
    register.fillRegisterForm(shortName + sufix, longName + sufix, passwd, sufix + email, false, true);
    sleep(1000);
    login.assertIsConnectedAs(sufix);
    entityHeader.waitForEntityTitle(longName + sufix);
    register.getWelcomeMsg().click();

    // home space
    showTitleSlide(t("Home space (your welcome page)"),
            t("Here you can see a summary of your activity in this site"));
    sleep(1000);
    site.homeSpaceBtn.click();
    sleep(2000);
    homeSpace.getSndStats().click();
    doScreenshot("home-stats");
    sleep(2000);
    homeSpace.getTrdStats().click();
    sleep(2000);

    // user space
    showTitleSlide(t("Your Inbox"), t("contents in which you participate"));
    sleep(1000);
    showTooltip(site.userSpaceBtn);
    site.userSpaceBtn.click();
    showMsg(t("You can see this like an advanced email system..."));
    userSpace.getFirstWave().click();
    sleep(2000);
    userSpace.getNewWave().click();

    userSpace.getAddParcipant().click();
    sleep(1000);
    answerOnNextPrompt(buddy);
    sleep(3000);

    showMsg(t("where you can compose personal messages..."));
    sleep(1000);
    showMsg(t("but also create contents to publish later"));
    sleep(1000);
    userSpace.rootBlipText().sendKeys(t("Congratulations for your report\n\n"));
    sleep(1000);
    userSpace.getCursive().click();
    userSpace.rootBlipText().sendKeys(t("Hi there, Just to say that I like") + t("a lot your last report\n\n"));
    sleep(1000);
    userSpace.getCursive().click();
    userSpace.rootBlipText().sendKeys(t("Best\n\nJane"));
    sleep(3000);
    userSpace.getRootEdit().click();
    sleep(3000);
    doScreenshot("inbox");
    sleep(2000);

    // group space
    showTitleSlide(t("Your personal public space"), t("here you can have your blog, etc"));
    sleep(500);
    site.groupSpaceBtn.click();
    site.groupSpaceBtn.click();
    showMsg(t("Let's start adding some buddie to our social network"));
    sleep(1000);
    groupSpace.addBuddieBtn.click();
    groupSpace.addNewBuddieTextBox.click();
    groupSpace.addNewBuddieTextBox.sendKeys(buddy);
    groupSpace.addNewBuddieTextBox.sendKeys(Keys.ARROW_DOWN);
    doScreenshot("social-net");
    sleep(500);
    groupSpace.firstFromSuggestionBox.click();
    site.confirmationOk.click();
    sleep(500);
    groupSpace.searchEntitiesOk.click();
    // groupSpace.firstAvatarOfGroup().click();
    sleep(2000);

    // Chat space
    showTitleSlide(t("Chat with your buddies"), t("compatible with gmail and similars"), SiteTokens.WAVE_INBOX); //
    showTooltip(chat.icon());
    chat.show();
    sleep(2000);

    final XmppURI jid = XmppURI.jid(buddy + "@" + SeleniumConf.SITE.getDomain());
    final String jids = jid.toString();
    // chat.getRosterItem("", jids).click();

    chat.openChat(jid);

    chat.getPage(jids).click();
    chat.getTalkBox(jids).sendKeys(t("Helloo... ;)"));
    chat.getSend(jids).click();
    chat.getTalkBox(jids).sendKeys(t("I'm just testing"));
    chat.getSend(jids).click();

    showMsg(t("And you can chat event while going back/forward with your browser"));
    site.homeSpaceBtn.click();
    sleep(2000);
    chat.getTalkBox(jids).sendKeys(t("la la la"));
    chat.getSend(jids).click();
    showMsg(t("Browser history back"));
    browserBack();
    sleep(2000);
    chat.getTalkBox(jids).sendKeys(t("I can continue chat smoothly ;)"));
    chat.getSend(jids).click();
    sleep(2000);
    showMsg(t("Browser history forward"));
    browserForward();
    sleep(1000);
    showMsg(t("And more options for your contacts"));
    chat.getItemMenu("", jids).click();
    chat.getTalkBox(jids).sendKeys(t("goodbye!"));
    doScreenshot("chat");

    chat.getSend(jids).click();
    sleep(1000);
    // Doesn't works
    // chat.getTalkBox(jids).sendKeys(Keys.chord(Keys.ALT, "C")); //
    // chat.close();
    // workaround:
    chat.chatIcon.click();

    // group space

    final String shortname = "yseg";
    final String longname = t("Yellow Summarine Environmental Group ");
    final String description = t("The Yellow Summarine Environmental Group is an Argentine-Based environmental"
            + " direct action group. Currently we are focusing or activities in the environmental impact of mining.");
    final String tags = t("environmental, Argentina, action");

    groupCreation(shortname, longname, description, tags, GroupType.PROJECT, sufix);

    login.logout();

    showTitleSlide(t("Thank you"), t("and yes, feedback welcome"));

}

From source file:com.cisco.dbds.utils.selenium.SeleniumUtilities.java

License:Open Source License

/**
 * Selects an option from dropdown./*from  w w  w  . j  av  a 2 s  .c o  m*/
 * 
 * @param dropDown
 *            the drop down
 * @param optionsListXpath
 *            the options list xpath
 * @param option
 *            the option
 */
public static void selectFromDropdown(WebElement dropDown, String optionsListXpath, String option) {
    waitForElement(dropDown);
    if (dropDown.isDisplayed() && dropDown.isEnabled()) {
        click(dropDown);

        String initialValue = driver.switchTo().activeElement().getText();
        boolean found = false;

        while (found == false) {
            driver.switchTo().activeElement().sendKeys(Keys.ARROW_DOWN);
            if (driver.switchTo().activeElement().getText().equals(initialValue)) {
                break;
            } else {
                if (driver.switchTo().activeElement().getText().equals(option)) {
                    LogHandler.printToConsole(
                            "\tSelecting the option : " + driver.switchTo().activeElement().getText());
                    driver.switchTo().activeElement().click();
                    found = true;
                }

            }
        }
    }

}

From source file:com.cisco.dbds.utils.selenium.SeleniumUtilities.java

License:Open Source License

/**
 * Scroll./*from   w  w w . j  av  a  2 s .  c om*/
 * 
 * @param selectableWebelementforScroll
 *            the selectable webelementfor scroll
 * @param stepsize
 *            the stepsize
 */
public static void scroll(WebElement selectableWebelementforScroll, int stepsize) {
    click(selectableWebelementforScroll);
    for (int i = 0; i < stepsize; i++) {
        Actions actionObject = new Actions(driver);
        actionObject.sendKeys(Keys.ARROW_DOWN).build().perform();
    }

}

From source file:com.codenvy.ide.operation.java.JavaFoldSelectionTest.java

License:Open Source License

@Test
public void foldPartOfComment() throws Exception {
    IDE.JAVAEDITOR.waitJavaEditorIsActive();
    IDE.PROGRESS_BAR.waitProgressBarControlClose();
    // select fold part of the comment.
    IDE.GOTOLINE.goToLine(4);//  www. j  a  v  a  2  s  .  c  om
    IDE.JAVAEDITOR.waitJavaEditorIsActive();
    // select 4 lines of the comment
    for (int i = 0; i < 4; i++) {
        IDE.JAVAEDITOR.typeTextIntoJavaEditor(Keys.SHIFT.toString() + Keys.ARROW_DOWN);
    }

    // fold selected lines from context menu
    IDE.JAVAEDITOR.callContextMenuIntoJavaEditor();
    IDE.CONTEXT_MENU.waitOpened();
    IDE.CONTEXT_MENU.waitWhileCommandIsEnabled("Fold Selection");
    IDE.CONTEXT_MENU.runCommand("Fold Selection");
    IDE.CONTEXT_MENU.waitClosed();

    // check that selected text is folded and expand button appear in right line
    IDE.JAVAEDITOR.waitWhileJavaEditorWillContainSpecifiedText(FOLDED_PART_OF_COMMENT);
    IDE.JAVAEDITOR.waitGutterExpandButtonInSpecifiedLineNumber(4);
    IDE.JAVAEDITOR.waitExpandButtonInSpecifiedLineNumber(4);

    // expand folded text and check content
    IDE.JAVAEDITOR.clickOnExpandButtonInSpecifiedLineNumber(4);
    IDE.JAVAEDITOR.waitWhileJavaEditorWillContainSpecifiedText(FILE_CONTENT);
}

From source file:com.codenvy.ide.operation.java.JavaFoldSelectionTest.java

License:Open Source License

@Test
public void foldFewMethods() throws Exception {
    IDE.JAVAEDITOR.waitJavaEditorIsActive();

    // select and fold few methods
    IDE.GOTOLINE.goToLine(35);/*from   ww w.  j  a  v a  2  s  . c om*/

    // select 4 lines of the comment
    for (int i = 0; i < 9; i++) {
        IDE.JAVAEDITOR.typeTextIntoJavaEditor(Keys.SHIFT.toString() + Keys.ARROW_DOWN);
    }

    IDE.MENU.runCommand(MenuCommands.Edit.EDIT_MENU, MenuCommands.Edit.FOLD_SELECTION);

    // check that selected text is folded and expand button appear in right line
    IDE.JAVAEDITOR.waitWhileJavaEditorWillContainSpecifiedText(FOLDED_FEW_METHODS);
    IDE.JAVAEDITOR.waitGutterExpandButtonInSpecifiedLineNumber(35);
    IDE.JAVAEDITOR.waitExpandButtonInSpecifiedLineNumber(35);

    // expand folding and check content
    IDE.JAVAEDITOR.clickOnExpandButtonInSpecifiedLineNumber(35);
    IDE.JAVAEDITOR.waitWhileJavaEditorWillContainSpecifiedText(FILE_CONTENT);
}

From source file:com.codenvy.ide.operation.java.JavaFoldSelectionTest.java

License:Open Source License

@Test
public void foldPartOfCommentAndCode() throws Exception {
    IDE.JAVAEDITOR.waitJavaEditorIsActive();

    // select and fold few methods
    IDE.GOTOLINE.goToLine(6);/*from w w  w .j  ava  2 s  .c om*/

    // select 4 lines of the comment
    for (int i = 0; i < 20; i++) {
        IDE.JAVAEDITOR.typeTextIntoJavaEditor(Keys.SHIFT.toString() + Keys.ARROW_DOWN);
    }

    IDE.MENU.runCommand(MenuCommands.Edit.EDIT_MENU, MenuCommands.Edit.FOLD_SELECTION);

    // check that selected text is folded and expand button appear in right line
    IDE.JAVAEDITOR.waitWhileJavaEditorWillContainSpecifiedText(FOLDED_PART_OF_COMMENT_AND_CODE);
    IDE.JAVAEDITOR.waitGutterExpandButtonInSpecifiedLineNumber(6);
    IDE.JAVAEDITOR.waitExpandButtonInSpecifiedLineNumber(6);

    // expand folding and check content
    IDE.JAVAEDITOR.clickOnExpandButtonInSpecifiedLineNumber(6);
    IDE.JAVAEDITOR.waitWhileJavaEditorWillContainSpecifiedText(FILE_CONTENT);
}

From source file:com.codenvy.ide.operation.java.JavaFoldSelectionTest.java

License:Open Source License

@Test
public void foldPartOfImportsAndCode() throws Exception {
    IDE.JAVAEDITOR.waitJavaEditorIsActive();
    IDE.GOTOLINE.goToLine(15);//from w  ww.j av  a  2s  .  c  o  m

    // select 10 lines of the code include imports and part of code
    for (int i = 0; i < 10; i++) {
        IDE.JAVAEDITOR.typeTextIntoJavaEditor(Keys.SHIFT.toString() + Keys.ARROW_DOWN);
    }

    // call fold selection from edit menu
    IDE.MENU.runCommand(MenuCommands.Edit.EDIT_MENU, MenuCommands.Edit.FOLD_SELECTION);

    // check that selected text is folded and expand button appear in right line
    IDE.JAVAEDITOR.waitWhileJavaEditorWillContainSpecifiedText(FOLDED_PART_OF_IMPORTS_AND_CODE);
    IDE.JAVAEDITOR.waitGutterExpandButtonInSpecifiedLineNumber(15);
    IDE.JAVAEDITOR.waitExpandButtonInSpecifiedLineNumber(15);

    // expand folded text and check content
    IDE.JAVAEDITOR.clickOnGutterExpandButtonInSpecifiedLineNumber(15);
    IDE.JAVAEDITOR.waitWhileJavaEditorWillContainSpecifiedText(FILE_CONTENT);

    // collapse folding and check that expand button appear
    IDE.JAVAEDITOR.waitGutterCollapseButtonInSpecifiedLineNumber(15);
    IDE.JAVAEDITOR.clickOnGutterCollapseButtonInSpecifiedLineNumber(15);
    IDE.JAVAEDITOR.waitWhileJavaEditorWillContainSpecifiedText(FOLDED_PART_OF_IMPORTS_AND_CODE);

    IDE.JAVAEDITOR.waitGutterExpandButtonInSpecifiedLineNumber(15);
    IDE.JAVAEDITOR.waitExpandButtonInSpecifiedLineNumber(15);

    // expand folding
    IDE.JAVAEDITOR.clickOnExpandButtonInSpecifiedLineNumber(15);
    IDE.JAVAEDITOR.waitWhileJavaEditorWillContainSpecifiedText(FILE_CONTENT);

    //
    // repeat same case but with different number of the selected lines
    //

    reopenForFirefox();

    IDE.GOTOLINE.goToLine(15);
    IDE.STATUSBAR.waitCursorPositionAt("15 : 1");
    // select 9 lines of the code include imports and part of code
    for (int i = 0; i < 8; i++) {
        IDE.JAVAEDITOR.typeTextIntoJavaEditor(Keys.SHIFT.toString() + Keys.ARROW_DOWN);
    }

    // call fold selection from edit menu
    IDE.MENU.runCommand(MenuCommands.Edit.EDIT_MENU, MenuCommands.Edit.FOLD_SELECTION);

    // check that selected text is folded and expand button appear in right line
    IDE.JAVAEDITOR.waitWhileJavaEditorWillContainSpecifiedText(FOLDED_PART_OF_IMPORTS_AND_CODE_2);
    IDE.JAVAEDITOR.waitGutterExpandButtonInSpecifiedLineNumber(15);
    IDE.JAVAEDITOR.waitExpandButtonInSpecifiedLineNumber(15);

    // expand folded text and check content
    IDE.JAVAEDITOR.clickOnGutterExpandButtonInSpecifiedLineNumber(15);
    IDE.JAVAEDITOR.waitWhileJavaEditorWillContainSpecifiedText(FILE_CONTENT);

    // collapse folding and check that expand button appear
    IDE.JAVAEDITOR.waitGutterCollapseButtonInSpecifiedLineNumber(15);
    IDE.JAVAEDITOR.clickOnGutterCollapseButtonInSpecifiedLineNumber(15);
    IDE.JAVAEDITOR.waitWhileJavaEditorWillContainSpecifiedText(FOLDED_PART_OF_IMPORTS_AND_CODE_2);

    IDE.JAVAEDITOR.waitGutterExpandButtonInSpecifiedLineNumber(15);
    IDE.JAVAEDITOR.waitExpandButtonInSpecifiedLineNumber(15);

    // expand folding
    IDE.JAVAEDITOR.clickOnExpandButtonInSpecifiedLineNumber(15);
    IDE.JAVAEDITOR.waitWhileJavaEditorWillContainSpecifiedText(FILE_CONTENT);
}

From source file:com.gargoylesoftware.htmlunit.selenium.TypingTest.java

License:Apache License

/**
 * A test.//w  ww  .  j  a v  a  2s  . c om
 */
@Test
public void shouldReportKeyCodeOfArrowKeys() {
    final WebDriver driver = getWebDriver("/javascriptPage.html");

    final WebElement result = driver.findElement(By.id("result"));
    final WebElement element = driver.findElement(By.id("keyReporter"));

    element.sendKeys(Keys.ARROW_DOWN);
    checkRecordedKeySequence(result, 40);

    element.sendKeys(Keys.ARROW_UP);
    checkRecordedKeySequence(result, 38);

    element.sendKeys(Keys.ARROW_LEFT);
    checkRecordedKeySequence(result, 37);

    element.sendKeys(Keys.ARROW_RIGHT);
    checkRecordedKeySequence(result, 39);

    // And leave no rubbish/printable keys in the "keyReporter"
    assertThat(element.getAttribute("value"), is(""));
}