List of usage examples for org.openqa.selenium Keys LEFT_CONTROL
Keys LEFT_CONTROL
To view the source code for org.openqa.selenium Keys LEFT_CONTROL.
Click Source Link
From source file:com.opera.core.systems.DriverKeysTest.java
License:Apache License
@Test public void testCopyPasteLeftControl() throws Exception { new Actions(driver).sendKeys("hello world").sendKeys(Keys.LEFT_CONTROL + "a") .sendKeys(Keys.LEFT_CONTROL + "c").sendKeys(fieldTwo, Keys.LEFT_CONTROL + "v").build().perform(); assertEquals("hello world", fieldTwo.getAttribute("value")); }
From source file:org.eclipse.che.selenium.theia.TheiaBuildPluginTest.java
License:Open Source License
@Test public void pluginShouldBeBuilt() { final String pluginNameSearchSequence = "hello-world"; final String yeomanWizardSearchSequence = ">yeom"; final String helloWorldPluginProposal = "Hello World plug-in"; final String goToDirectoryCommand = "cd hello-world"; final String wsTheiaIdeTerminalTitle = "ws/theia-ide terminal 0"; final String expectedYaomanMessage = "Yeoman generator successfully ended"; final String expectedTerminalSuccessOutput = "Packaging of plugin\n" + "\uD83D\uDD0D Validating...?\n" + "\uD83D\uDDC2 Getting dependencies...?\n" + "\uD83D\uDDC3 Resolving files...?\n" + "? Excluding files...?\n" + "?? Generating Assembly...?\n" + "\uD83C\uDF89 Generated plugin: hello_world.theia"; final String backendPluginDescription = "Backend plug-in, it will run on the server side."; // prepare project tree theiaProjectTree.waitFilesTab();/*from www. j a v a 2 s. co m*/ theiaProjectTree.clickOnFilesTab(); theiaIde.waitNotificationDisappearance("Che Workspace: Finished cloning projects.", UPDATING_PROJECT_TIMEOUT_SEC); // create project by "Yeoman Wizard" theiaIde.pressKeyCombination(Keys.LEFT_CONTROL, Keys.LEFT_SHIFT, "p"); theiaProposalForm.waitForm(); theiaProposalForm.enterTextToSearchField(yeomanWizardSearchSequence); theiaProposalForm.waitProposal("Yeoman Wizard"); theiaProposalForm.clickOnProposal("Yeoman Wizard"); try { theiaProposalForm.waitForm(); } catch (TimeoutException ex) { // remove try-catch block after issue has been resolved fail("Known permanent failure https://github.com/eclipse/che/issues/12315"); } theiaProposalForm.enterTextToSearchField(pluginNameSearchSequence); seleniumWebDriverHelper.pressEnter(); theiaProposalForm.clickOnProposal(backendPluginDescription); theiaProposalForm.clickOnProposal(helloWorldPluginProposal); theiaIde.waitNotificationMessageContains(expectedYaomanMessage, UPDATING_PROJECT_TIMEOUT_SEC); theiaIde.waitNotificationDisappearance(expectedYaomanMessage, UPDATING_PROJECT_TIMEOUT_SEC); // build plugin openTerminalByProposal("ws/theia-ide"); theiaTerminal.waitTab(wsTheiaIdeTerminalTitle); theiaTerminal.clickOnTab(wsTheiaIdeTerminalTitle); theiaTerminal.performCommand(goToDirectoryCommand); theiaTerminal.waitTerminalOutput(goToDirectoryCommand, 0); theiaTerminal.clickOnTab(wsTheiaIdeTerminalTitle); theiaTerminal.waitTabSelected(wsTheiaIdeTerminalTitle); theiaTerminal.performCommand("yarn"); try { theiaTerminal.waitTerminalOutput(expectedTerminalSuccessOutput, 0); } catch (TimeoutException ex) { // remove try-catch block after issue has been resolved fail("Known permanent failure https://github.com/eclipse/che/issues/11624", ex); } }
From source file:org.eclipse.che.selenium.theia.TheiaBuildPluginTest.java
License:Open Source License
@Test(priority = 1) public void hostedModeShouldWork() { final String projectName = "hello-world"; final String hostedSearchSequence = ">hosted"; final String editedSourceFile = "hello-world-backend.ts"; final String expectedHelloWorldNotification = "Hello World!"; final String expectedAlohaWorldNotification = "Aloha World!"; final String suggestionForSelection = "Hosted Plugin: Start Instance"; final String helloWorldProposal = "Hello World"; final String helloWorldSearchSequence = ">Hello"; final String expectedInstanceRunningMessage = "Hosted instance is running at:"; final String parentWindow = seleniumWebDriver.getWindowHandle(); final String expectedPluginFolderMessage = "Plugin folder is set to: file:///projects/hello-world"; final String expectedStartingServerMessage = "Starting hosted instance server ..."; final String editedSourceLine = "theia.window.showInformationMessage('Aloha World!');"; final String expectedTextAfterDeleting = "context.subscriptions.push(theia.commands.registerCommand(informationMessageTestCommand, (...args: any[]) => {\n" + " \n" + " }));"; // run hosted mode theiaProjectTree.waitItem(projectName); theiaProjectTree.clickOnItem(projectName); theiaProjectTree.waitItemSelected(projectName); theiaIde.pressKeyCombination(Keys.LEFT_CONTROL, Keys.LEFT_SHIFT, "p"); theiaProposalForm.waitForm();/*from w ww . j a v a 2 s .c o m*/ theiaProposalForm.enterTextToSearchField(hostedSearchSequence); theiaProposalForm.clickOnProposal(suggestionForSelection); hostedPluginSelectPathForm.waitForm(); hostedPluginSelectPathForm.clickOnProjectItem(projectName); hostedPluginSelectPathForm.waitProjectItemSelected(projectName); hostedPluginSelectPathForm.clickOnOpenButton(); hostedPluginSelectPathForm.waitFormClosed(); waitNotificationEqualsTo(expectedPluginFolderMessage, parentWindow); waitNotificationEqualsTo(expectedStartingServerMessage, parentWindow); waitNotificationContains(expectedInstanceRunningMessage, parentWindow); // check hosted mode availability switchToNonParentWindow(parentWindow); waitHostedPageReady(); theiaProjectTree.clickOnFilesTab(); theiaProjectTree.waitProjectAreaOpened(); theiaProjectTree.waitItem(projectName); // check plugin output theiaIde.pressKeyCombination(Keys.LEFT_CONTROL, Keys.LEFT_SHIFT, "p"); theiaProposalForm.waitSearchField(); theiaProposalForm.enterTextToSearchField(helloWorldSearchSequence); theiaProposalForm.clickOnProposal(helloWorldProposal); theiaIde.waitNotificationEqualsTo(expectedHelloWorldNotification); theiaIde.waitNotificationDisappearance(expectedHelloWorldNotification); // check editing of the source code switchToParentWindow(parentWindow); theiaProjectTree.waitProjectAreaOpened(); theiaProjectTree.waitItem(projectName); theiaProjectTree.expandPathAndOpenFile(projectName + "/src", editedSourceFile); theiaEditor.waitEditorTab(editedSourceFile); theiaEditor.waitTabSelecting(editedSourceFile); theiaEditor.waitActiveEditor(); theiaEditor.selectLineText(14); seleniumWebDriverHelper.pressDelete(); theiaEditor.waitEditorText(expectedTextAfterDeleting); theiaEditor.enterTextByTypingEachChar(editedSourceLine); theiaEditor.waitEditorText(editedSourceLine); theiaEditor.waitTabSavedStatus(editedSourceFile); // check applying of the changes in hosted mode window switchToNonParentWindow(parentWindow); waitHostedPageReady(); seleniumWebDriver.navigate().refresh(); waitHostedPageReady(); theiaProjectTree.waitProjectAreaOpened(); theiaProjectTree.waitItem(projectName); theiaIde.pressKeyCombination(Keys.LEFT_CONTROL, Keys.LEFT_SHIFT, "p"); theiaProposalForm.waitSearchField(); theiaProposalForm.enterTextToSearchField(helloWorldSearchSequence); theiaProposalForm.clickOnProposal(helloWorldProposal); theiaIde.waitNotificationEqualsTo(expectedAlohaWorldNotification); theiaIde.waitNotificationDisappearance(expectedAlohaWorldNotification); }
From source file:org.eclipse.che.selenium.theia.TheiaBuildPluginTest.java
License:Open Source License
private void openTerminalByProposal(String proposalText) { theiaIde.pressKeyCombination(Keys.LEFT_CONTROL, "`"); theiaProposalForm.waitProposal(proposalText); theiaProposalForm.clickOnProposal(proposalText); theiaProposalForm.waitFormDisappearance(); }
From source file:org.safs.selenium.webdriver.lib.WDLibrary.java
License:Open Source License
/** * * @param key Keys, the selenium Keys value * @return int the value of java KeyEvent * @throws SeleniumPlusException/*from ww w. j a va2s .c om*/ */ static int toJavaKeyCode(Keys key) throws SeleniumPlusException { String debugmsg = StringUtils.debugmsg(WDLibrary.class, "toJavaKeyCode"); if (Keys.SHIFT.equals(key)) return KeyEvent.VK_SHIFT; else if (Keys.LEFT_SHIFT.equals(key)) return KeyEvent.VK_SHIFT; else if (Keys.CONTROL.equals(key)) return KeyEvent.VK_CONTROL; else if (Keys.LEFT_CONTROL.equals(key)) return KeyEvent.VK_CONTROL; else if (Keys.ALT.equals(key)) return KeyEvent.VK_ALT; else if (Keys.LEFT_ALT.equals(key)) return KeyEvent.VK_ALT; else { String msg = " No handled key '" + (key == null ? "null" : key.toString()) + "'."; IndependantLog.debug(debugmsg + msg); throw new SeleniumPlusException(msg); } }
From source file:org.zanata.page.webtrans.EditorPage.java
License:Open Source License
/** * Simulate a paste from the user's clipboard into the indicated row * * @param rowIndex row to enter text/*from w w w . j a v a2 s. c om*/ * @param text text to be entered * @return new EditorPage */ public EditorPage pasteIntoRowAtIndex(final long rowIndex, final String text) { log.info("Paste at {} the text {}", rowIndex, text); WebElement we = readyElement(By.id(String.format(TARGET_ID_FMT, rowIndex, Plurals.SourceSingular.index()))); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(new StringSelection(text), null); we.click(); we.sendKeys(Keys.LEFT_CONTROL + "v"); return new EditorPage(getDriver()); }