Example usage for org.openqa.selenium Keys TAB

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

Introduction

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

Prototype

Keys TAB

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

Click Source Link

Usage

From source file:org.auraframework.test.util.WebDriverTestCase.java

License:Apache License

public Action shiftTab() {
    Actions builder = new Actions(currentDriver);
    builder.keyDown(Keys.SHIFT).sendKeys(Keys.TAB).keyUp(Keys.SHIFT);
    return builder.build();
}

From source file:org.bigtester.ate.model.page.elementaction.SendKeysAction.java

License:Apache License

/**
 * {@inheritDoc}/*  ww w  .j  av a  2 s  . c o  m*/
 */
@Override
public void doAction(final WebElement webElm) {
    IStepInputData inputData = getDataValue();
    if (null == inputData) {
        throw new IllegalStateException("inputDatavalue is not correctly populated.");
    } else {
        if (inputData.getStrDataValue().equals("[TAB]")) {
            webElm.sendKeys(Keys.TAB);
        } else if (inputData.getStrDataValue().equals("[ENTER]")) {
            webElm.sendKeys(Keys.ENTER);
        } else {
            webElm.sendKeys(inputData.getStrDataValue());
        }
        LogbackWriter.writeAppInfo("action tracing: send keys to browser: " + inputData.getStrDataValue());
    }

}

From source file:org.callimachusproject.webdriver.helpers.WebBrowserDriver.java

License:Apache License

public void type(By locator, String text) {
    waitForScript();//from  w ww.  j  av  a 2  s  .  c o  m
    WebElement element = driver.findElement(locator);
    element.clear();
    sendKeys(element, text);
    // tab to the next element to fire onchange event
    sendKeys(element, Keys.TAB);
}

From source file:org.eclipse.che.selenium.editor.autocomplete.ShowHintsCommandTest.java

License:Open Source License

@Test
public void checkShowHintsCommand() {
    projectExplorer.waitProjectExplorer();
    projectExplorer.waitItem(PROJECT_NAME);
    console.closeProcessesArea();/*from w ww. j av  a 2 s  . c o  m*/
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
    loader.waitOnClosed();
    projectExplorer.openItemByVisibleNameInExplorer("HintTestClass.java");
    loader.waitOnClosed();

    // check the 'show hints' to all parameters on the overloaded method
    editor.selectTabByName("AppController");
    editor.waitActiveEditor();
    editor.setCursorToLine(32);
    editor.typeTextIntoEditor(Keys.TAB.toString());
    editor.typeTextIntoEditor("runCommand();");
    editor.waitTextIntoEditor("runCommand();");
    editor.typeTextIntoEditor(Keys.HOME.toString());
    editor.callShowHintsPopUp();
    editor.waitShowHintsPopUpOpened();
    editor.waitExpTextIntoShowHintsPopUp(TEXT_IN_POP_UP_1);
    editor.typeTextIntoEditor(Keys.ESCAPE.toString());
    editor.waitShowHintsPopUpClosed();

    // check the 'show hints' to all parameters on the overloaded constructor
    editor.waitActiveEditor();
    editor.setCursorToLine(27);
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor(Keys.TAB.toString());
    editor.typeTextIntoEditor(CONSTRUCTOR);
    editor.waitTextIntoEditor(CONSTRUCTOR);
    editor.setCursorToDefinedLineAndChar(28, 41);
    editor.callShowHintsPopUp();
    editor.waitShowHintsPopUpOpened();
    editor.waitExpTextIntoShowHintsPopUp(TEXT_IN_POP_UP_2);
    editor.typeTextIntoEditor(Keys.ESCAPE.toString());
    editor.waitShowHintsPopUpClosed();
}

From source file:org.eclipse.che.selenium.plainjava.PlainJavaProjectConfigureClasspathTest.java

License:Open Source License

@Test
public void checkConfigureClasspathPlainJavaProject() {
    projectExplorer.waitProjectExplorer();
    projectExplorer.waitItem(PROJECT_NAME);
    projectExplorer.waitItem(LIB_PROJECT);
    projectExplorer.openItemByPath(PROJECT_NAME);
    projectExplorer.waitItem(PROJECT_NAME + "/bin");
    projectExplorer.waitItem(PROJECT_NAME + "/src");
    projectExplorer.waitItem(PROJECT_NAME + "/test");

    // check build path to the subfolder 'java' from context menu
    projectExplorer.openItemByPath(PROJECT_NAME + "/test");
    projectExplorer.openItemByPath(PROJECT_NAME + "/test/java");
    projectExplorer.openItemByPath(PROJECT_NAME + "/test/java/com");
    projectExplorer.openItemByPath(PROJECT_NAME + "/test/java/com/company");
    projectExplorer.selectItem(PROJECT_NAME + "/test/java");
    projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/test/java");
    projectExplorer.clickOnItemInContextMenu(BUILD_PATH);
    projectExplorer.clickOnItemInContextMenu(USE_AS_SOURCE_FOLDER);
    projectExplorer.waitItem(PROJECT_NAME + "/test/java/com/company");
    projectExplorer.selectItem(PROJECT_NAME + "/test/java");
    projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/test/java");
    projectExplorer.clickOnItemInContextMenu(BUILD_PATH);
    loader.waitOnClosed();/*from ww  w.ja  v a2  s .  c  o  m*/
    projectExplorer.clickOnItemInContextMenu(UNMARK_AS_SOURCE_FOLDER);
    projectExplorer.waitDisappearItemByPath(PROJECT_NAME + "/test/java/com/company");

    // check build path to the folder 'test' from context menu
    projectExplorer.selectItem(PROJECT_NAME + "/test");
    projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/test");
    projectExplorer.clickOnItemInContextMenu(BUILD_PATH);
    projectExplorer.clickOnItemInContextMenu(USE_AS_SOURCE_FOLDER);
    projectExplorer.waitItem(PROJECT_NAME + "/test/java/com/company");
    projectExplorer.selectItem(PROJECT_NAME + "/test");
    projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/test");
    projectExplorer.clickOnItemInContextMenu(BUILD_PATH);
    loader.waitOnClosed();
    projectExplorer.clickOnItemInContextMenu(UNMARK_AS_SOURCE_FOLDER);
    projectExplorer.waitDisappearItemByPath(PROJECT_NAME + "/test/java/com/company");

    // check the 'Cancel' button of the 'Select Path' form
    projectExplorer.selectItem(PROJECT_NAME);
    menu.runCommand(TestMenuCommandsConstants.Project.PROJECT,
            TestMenuCommandsConstants.Project.CONFIGURE_CLASSPATH);
    configureClasspath.waitConfigureClasspathFormIsOpen();
    configureClasspath.selectSourceCategory();
    configureClasspath.addJarOrFolderToBuildPath(ConfigureClasspath.ADD_FOLDER);
    configureClasspath.waitSelectPathFormIsOpen();
    configureClasspath.clickCancelBtnSelectPathForm();

    // check adding and deleting of a source folder
    configureClasspath.waitExpectedTextJarsAndFolderArea("/" + PROJECT_NAME + "/src");
    configureClasspath.addJarOrFolderToBuildPath(ConfigureClasspath.ADD_FOLDER);
    configureClasspath.waitSelectPathFormIsOpen();
    configureClasspath.openItemInSelectPathForm(PROJECT_NAME);
    configureClasspath.waitItemInSelectPathForm("bin");
    configureClasspath.waitItemInSelectPathForm("src");
    configureClasspath.waitItemInSelectPathForm("test");
    configureClasspath.selectItemInSelectPathForm("test");
    configureClasspath.clickOkBtnSelectPathForm();
    configureClasspath.waitExpectedTextJarsAndFolderArea("/" + PROJECT_NAME + "/test");
    configureClasspath.clickOnDoneBtnConfigureClasspath();
    projectExplorer.waitItem(PROJECT_NAME + "/test/java/com/company");
    projectExplorer.selectItem(PROJECT_NAME);
    projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME);
    projectExplorer.clickOnItemInContextMenu(BUILD_PATH);
    projectExplorer.clickOnItemInContextMenu(CONFIGURE_CLASSPATH);
    configureClasspath.waitConfigureClasspathFormIsOpen();
    configureClasspath.selectSourceCategory();
    configureClasspath.deleteJarOrFolderFromBuildPath("/" + PROJECT_NAME + "/test");
    configureClasspath.waitExpectedTextIsNotPresentInJarsAndFolderArea("/" + PROJECT_NAME + "/test");
    configureClasspath.clickOnDoneBtnConfigureClasspath();
    projectExplorer.openItemByPath(PROJECT_NAME + "/test");
    projectExplorer.waitDisappearItemByPath(PROJECT_NAME + "/test/java/com/company");

    // check the library container
    projectExplorer.selectItem(PROJECT_NAME);
    menu.runCommand(PROJECT, CONFIGURE_CLASSPATH);
    configureClasspath.waitConfigureClasspathFormIsOpen();
    configureClasspath.clickLibraryContainer("org.eclipse.jdt.launching.JRE_CONTAINER");
    for (String jarName : listJar) {
        Assert.assertTrue(configureClasspath.getTextFromJarsAndFolderArea().contains(jarName));
    }
    configureClasspath.clickLibraryContainer("org.eclipse.jdt.launching.JRE_CONTAINER");
    configureClasspath.waitExpectedTextIsNotPresentInJarsAndFolderArea("rt.jar - /opt/jdk1.8.0_45/jre/lib");

    // check adding jar file
    configureClasspath.addJarOrFolderToBuildPath(ConfigureClasspath.ADD_JAR);
    configureClasspath.waitSelectPathFormIsOpen();
    configureClasspath.openItemInSelectPathForm(LIB_PROJECT);
    configureClasspath.selectItemInSelectPathForm("log4j-1.2.17.jar");
    configureClasspath.clickOkBtnSelectPathForm();
    configureClasspath.waitExpectedTextJarsAndFolderArea("log4j-1.2.17.jar - /projects/lib");
    configureClasspath.deleteJarOrFolderFromBuildPath("log4j-1.2.17.jar - /projects/lib");
    configureClasspath.waitExpectedTextIsNotPresentInJarsAndFolderArea("log4j-1.2.17.jar - /projects/lib");
    configureClasspath.addJarOrFolderToBuildPath(ConfigureClasspath.ADD_JAR);
    configureClasspath.waitSelectPathFormIsOpen();
    configureClasspath.openItemInSelectPathForm(LIB_PROJECT);
    configureClasspath.selectItemInSelectPathForm("mockito-all-1.9.5.jar");
    configureClasspath.clickOkBtnSelectPathForm();
    configureClasspath.waitExpectedTextJarsAndFolderArea("mockito-all-1.9.5.jar - /projects/lib");
    configureClasspath.clickOnDoneBtnConfigureClasspath();
    projectExplorer.openItemByPath(PROJECT_NAME + "/src");
    projectExplorer.openItemByPath(PROJECT_NAME + "/src/com/company");
    projectExplorer.openItemByPath(PROJECT_NAME + "/src/com/company/Main.java");
    codenvyEditor.waitActiveEditor();
    codenvyEditor.setCursorToLine(17);
    codenvyEditor.typeTextIntoEditor(Keys.ENTER.toString());
    loader.waitOnClosed();
    codenvyEditor.setCursorToLine(17);
    codenvyEditor.typeTextIntoEditor(Keys.TAB.toString());
    codenvyEditor.typeTextIntoEditor("Mockito mockito = new Mockito();");
    codenvyEditor.waitTextIntoEditor("Mockito mockito = new Mockito();");
    codenvyEditor.waitMarkerInPosition(ERROR_MARKER, 17);
    codenvyEditor.launchPropositionAssistPanel();
    codenvyEditor.enterTextIntoFixErrorPropByDoubleClick("Import 'Mockito' (org.mockito)");
    codenvyEditor.waitErrorPropositionPanelClosed();
    codenvyEditor.waitTextIntoEditor("import org.mockito.Mockito;");
    codenvyEditor.setCursorToLine(19);
    codenvyEditor.waitMarkerDisappears(ERROR_MARKER, 19);
}

From source file:org.eclipse.che.selenium.plainjava.RunPlainJavaProjectTest.java

License:Open Source License

@Test
public void checkRunPlainJavaProject() {
    // import the project and configure
    projectExplorer.waitProjectExplorer();
    importPlainJavaApp(CLONE_URI, PROJECT_NAME, Wizard.TypeProject.PLAIN_JAVA);
    loader.waitOnClosed();//from  www . j  a v  a2s  .c  o m

    // check library into configure classpath form
    projectExplorer.quickExpandWithJavaScript();
    loader.waitOnClosed();
    projectExplorer.selectItem(PROJECT_NAME);
    menu.runCommand(PROJECT, CONFIGURE_CLASSPATH);
    configureClasspath.waitConfigureClasspathFormIsOpen();
    configureClasspath.waitExpectedTextJarsAndFolderArea(
            "mockito-all-1.10.19.jar - /projects/" + PROJECT_NAME + "/store");
    configureClasspath.closeConfigureClasspathFormByIcon();

    // expand the project and use library
    projectExplorer.openItemByPath(PROJECT_NAME + "/src/com/company/nba/MainClass.java");
    codenvyEditor.waitActiveEditor();
    codenvyEditor.setCursorToLine(9);
    codenvyEditor.typeTextIntoEditor(Keys.TAB.toString());
    codenvyEditor.typeTextIntoEditor("Mockito mockito = new Mockito();");
    codenvyEditor.waitTextIntoEditor("Mockito mockito = new Mockito();");
    codenvyEditor.waitMarkerInPosition(ERROR_MARKER, 9);
    codenvyEditor.launchPropositionAssistPanel();
    codenvyEditor.enterTextIntoFixErrorPropByDoubleClick("Import 'Mockito' (org.mockito)");
    codenvyEditor.waitTextIntoEditor("import org.mockito.Mockito;");

    // Create new java class into new package
    projectExplorer.selectItem(PROJECT_NAME + "/src");
    menu.runCommand(PROJECT, NEW, PACKAGE);
    askForValueDialog.waitFormToOpen();
    askForValueDialog.typeAndWaitText(NEW_PACKAGE);
    askForValueDialog.clickOkBtn();
    askForValueDialog.waitFormToClose();
    projectExplorer.waitItemInVisibleArea(NEW_PACKAGE);
    projectExplorer.selectItem(PROJECT_NAME + "/src/base/test");
    menu.runCommand(TestMenuCommandsConstants.Project.PROJECT, NEW, JAVA_CLASS);
    loader.waitOnClosed();
    askForValueDialog.waitNewJavaClassOpen();
    askForValueDialog.typeTextInFieldName("A");
    askForValueDialog.clickOkBtnNewJavaClass();
    askForValueDialog.waitNewJavaClassClose();
    projectExplorer.waitItem(PROJECT_NAME + "/src/base/test/A.java");
    projectExplorer.openItemByPath(PROJECT_NAME + "/src/com/company/nba/MainClass.java");
    codenvyEditor.waitActiveEditor();
    codenvyEditor.setCursorToLine(12);
    codenvyEditor.typeTextIntoEditor(Keys.TAB.toString());
    codenvyEditor.typeTextIntoEditor("A a = new A();");
    codenvyEditor.waitTextIntoEditor("A a = new A();");
    codenvyEditor.waitMarkerInPosition(ERROR_MARKER, 12);
    codenvyEditor.launchPropositionAssistPanel();
    codenvyEditor.enterTextIntoFixErrorPropByDoubleClick("Import 'A' (base.test)");
    codenvyEditor.waitErrorPropositionPanelClosed();
    codenvyEditor.waitTextIntoEditor("import base.test.A;");

    // open the 'Commands Explorer' and choose java command
    projectExplorer.selectItem(PROJECT_NAME);
    loader.waitOnClosed();
    commandsExplorer.openCommandsExplorer();
    commandsExplorer.waitCommandExplorerIsOpened();
    commandsExplorer.clickAddCommandButton(RUN_GOAL);
    loader.waitOnClosed();
    commandsExplorer.chooseCommandTypeInContextMenu(JAVA_TYPE);
    loader.waitOnClosed();
    commandsExplorer.waitCommandInExplorerByName(JAVA_NAME);
    commandsEditor.waitActiveEditor();
    commandsEditor.waitTabFileWithSavedStatus(JAVA_NAME);

    // edit the name and the content of the java command into editor
    commandsEditor.typeTextIntoNameCommandField(NAME_COMMAND);
    commandsEditor.waitTextIntoNameCommandField(NAME_COMMAND);
    commandsEditor.waitTabCommandWithUnsavedStatus(JAVA_NAME);
    commandsEditor.setCursorToLine(1);
    commandsEditor.deleteAllContent();
    commandsEditor.typeTextIntoEditor(COMMAND);
    commandsEditor.waitTextIntoEditor(COMMAND);
    commandsEditor.clickOnSaveButtonInTheEditCommand();
    commandsEditor.waitTabFileWithSavedStatus(NAME_COMMAND);

    // check not starting application
    commandsEditor.clickOnRunButton();
    loader.waitOnClosed();
    consoles.waitExpectedTextIntoConsole(CONSOLE_MESS);

    // add the folder 'bin'
    projectExplorer.clickOnProjectExplorerTabInTheLeftPanel();
    commandsExplorer.waitCommandExplorerIsClosed();
    projectExplorer.waitProjectExplorer();
    projectExplorer.selectItem(PROJECT_NAME);
    projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME);
    projectExplorer.clickOnItemInContextMenu(TestProjectExplorerContextMenuConstants.NEW);
    projectExplorer.clickOnNewContextMenuItem(TestProjectExplorerContextMenuConstants.SubMenuNew.FOLDER);
    askForValueDialog.typeAndWaitText("bin");
    askForValueDialog.clickOkBtn();
    loader.waitOnClosed();
    projectExplorer.waitItem(PROJECT_NAME + "/bin");

    //check starting application
    commandsEditor.selectTabByName(NAME_COMMAND);
    commandsEditor.waitActiveTabFileName(NAME_COMMAND);
    commandsEditor.clickOnRunButton();
    loader.waitOnClosed();
    consoles.waitExpectedTextIntoConsole("I love this game!");

    // check the 'bin' folder that contains compiling classes
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.waitItem(PROJECT_NAME + "/bin/com/company/nba/MainClass.class");
    projectExplorer.waitItem(PROJECT_NAME + "/bin/base/test/A.class");
}

From source file:org.eclipse.che.selenium.refactor.move.CodeAssistAfterMoveItemTest.java

License:Open Source License

@Test
public void checkCodeAssistAfterMoveItem() {
    projectExplorer.openItemByPath(pathToPackageInChePrefix + "/org/eclipse/qa/examples/AppController.java");
    loader.waitOnClosed();/*  www.j  a v a  2 s  . c  om*/
    editor.waitActiveEditor();
    editor.setCursorToLine(31);
    editor.typeTextIntoEditor(Keys.TAB.toString());
    loader.waitOnClosed();
    editor.typeTextIntoEditor("A5 a = new A5();");
    loader.waitOnClosed();
    editor.waitTextIntoEditor("A5 a = new A5();");
    editor.waitMarkerInPosition(ERROR_MARKER, 31);
    editor.typeTextIntoEditor(Keys.END.toString());
    editor.launchPropositionAssistPanel();
    loader.waitOnClosed();
    editor.waitTextIntoFixErrorProposition("Import 'A5' (r)");
    editor.enterTextIntoFixErrorPropByDoubleClick("Import 'A5' (r)");
    loader.waitOnClosed();
    editor.waitTextIntoEditor("import r.A5;");
    editor.waitMarkerDisappears(ERROR_MARKER, 33);

    // move item 'A5' into package 'p1'
    projectExplorer.selectItem(pathToPackageInChePrefix + "/r/A5.java");
    projectExplorer.launchRefactorMoveByKeyboard();
    refactor.waitMoveItemFormIsOpen();
    refactor.clickOnExpandIconTree(PROJECT_NAME);
    refactor.clickOnExpandIconTree("/src/main/java");
    refactor.chooseDestinationForItem("p1");
    refactor.clickOkButtonRefactorForm();
    refactor.waitMoveItemFormIsClosed();
    loader.waitOnClosed();
    projectExplorer.waitItem(pathToPackageInChePrefix + "/p1/A5.java");
    projectExplorer.waitDisappearItemByPath(pathToPackageInChePrefix + "/r/A5.java");
    editor.waitTextIntoEditor("import p1.A5;");
    editor.setCursorToLine(16);
    editor.deleteCurrentLine();
    loader.waitOnClosed();
    editor.waitMarkerInPosition(ERROR_MARKER, 32);
    editor.setCursorToDefinedLineAndChar(32, 5);
    editor.launchPropositionAssistPanel();
    loader.waitOnClosed();
    editor.waitTextIntoFixErrorProposition("Import 'A5' (p1)");
    editor.enterTextIntoFixErrorPropByEnter("Import 'A5' (p1)");
    editor.waitTextIntoEditor("import p1.A5;");
}

From source file:org.eclipse.scout.rt.testing.ui.rap.RapMock.java

License:Open Source License

protected Keys toSeleniumKey(Key key) {
    switch (key) {
    case Shift://from w  ww.j a va  2 s .c  o m
        return Keys.SHIFT;
    case Control:
        return Keys.CONTROL;
    case Alt:
        return Keys.ALT;
    case Delete:
        return Keys.DELETE;
    case Backspace:
        return Keys.BACK_SPACE;
    case Enter:
        return Keys.ENTER;
    case Esc:
        return Keys.ESCAPE;
    case Tab:
        return Keys.TAB;
    case ContextMenu:
        throw new IllegalArgumentException("Unknown keyboard key: " + key);
    case Up:
        return Keys.UP;
    case Down:
        return Keys.DOWN;
    case Left:
        return Keys.LEFT;
    case Right:
        return Keys.RIGHT;
    case Windows:
        return Keys.META;
    case F1:
        return Keys.F1;
    case F2:
        return Keys.F2;
    case F3:
        return Keys.F3;
    case F4:
        return Keys.F4;
    case F5:
        return Keys.F5;
    case F6:
        return Keys.F6;
    case F7:
        return Keys.F7;
    case F8:
        return Keys.F8;
    case F9:
        return Keys.F9;
    case F10:
        return Keys.F10;
    case F11:
        return Keys.F11;
    case F12:
        return Keys.F12;
    case Home:
        return Keys.HOME;
    case End:
        return Keys.END;
    case PageUp:
        return Keys.PAGE_UP;
    case PageDown:
        return Keys.PAGE_DOWN;
    case NumPad0:
        return Keys.NUMPAD0;
    case NumPad1:
        return Keys.NUMPAD1;
    case NumPad2:
        return Keys.NUMPAD2;
    case NumPad3:
        return Keys.NUMPAD3;
    case NumPad4:
        return Keys.NUMPAD4;
    case NumPad5:
        return Keys.NUMPAD5;
    case NumPad6:
        return Keys.NUMPAD6;
    case NumPad7:
        return Keys.NUMPAD7;
    case NumPad8:
        return Keys.NUMPAD8;
    case NumPadMultiply:
        return Keys.MULTIPLY;
    case NumPadDivide:
        return Keys.DIVIDE;
    case NumPadAdd:
        return Keys.ADD;
    case NumPadSubtract:
        return Keys.SUBTRACT;
    case NumPadDecimal:
        return Keys.DECIMAL;
    case NumPadSeparator:
        return Keys.SEPARATOR;
    default:
        throw new IllegalArgumentException("Unknown keyboard key: " + key);
    }
}

From source file:org.hepaces.surveyfeedbacktestscript.KrogerFeedbackManager.java

/**
 * Centralized handling for numeric dropdowns (select elements)
 * @param numberDownArrowPresses/* w w  w .j  a  v  a 2 s . c om*/
 * @param input 
 */
private static void numericDropDownHandler(int numberDownArrowPresses, WebElement input) {
    input.click();
    for (int i = 1; i <= numberDownArrowPresses; i++) {
        input.sendKeys(Keys.ARROW_DOWN);
    }
    input.sendKeys(Keys.TAB);
}

From source file:org.jboss.seam.example.remoting.chatroom.test.webdriver.WebDriverChatroomTest.java

License:Open Source License

public void connect() {

    driver.findElement(NAME_INPUT).clearAndSendKeys(NAME1, Keys.TAB);

    driver.setWaitTime(timeout);//ww  w.  ja  v  a  2s.  co  m

    //more reliable than simple click
    driver.findElement(CONNECT_BUTTON).clearAndSendKeys(Keys.RETURN);

    try {
        Thread.sleep(timeout);
    } catch (InterruptedException e) {
    }
}