@Override public void sendKeys(CharSequence... keysToSend) { ensureWebDriver(); delegateKeyboard().sendKeys(keysToSend); }
public void perform() { focusOnElement(); keyboard.sendKeys(keysToSend); }
@Override protected void doPerform() { if (isSourceDocumentRoot()) { keyboard().sendKeys(keys); } else { getFirstElement().sendKeys(keys); } } }
/** * Deletes this suggestion from the list of selected suggestions. */ public void delete() { select(); // We don't send the keys directly to the text input because it can be hidden.(e.g. when multiple selection // is on and we click on a selected suggestion). getDriver().getKeyboard().sendKeys(Keys.BACK_SPACE); }
@ReplayOnError public void simulateSendKeys(CharSequence... keysToSend) { findElement(true); // click on element before sending keys through keyboard element.click(); JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("arguments[0].focus();", element); WebDriver realDriver = ((CustomEventFiringWebDriver)driver).getWebDriver(); // handle org.openqa.selenium.UnsupportedCommandException: sendKeysToActiveElement which are not available for firefox and IE if ((realDriver instanceof FirefoxDriver && FirefoxDriverFactory.isMarionetteMode()) || realDriver instanceof InternetExplorerDriver) { logger.warn("using specific Marionette method"); js.executeScript(String.format("arguments[0].value='%s';", keysToSend[0].toString()), element); } else { // use keyboard to type ((CustomEventFiringWebDriver)driver).getKeyboard().sendKeys(keysToSend); } }
public void sendKeys(CharSequence... charSequences) { Region control = Region.EMPTY; // We first find the active element to get the region WebElement activeElement = eyesDriver.switchTo().activeElement(); if (activeElement instanceof RemoteWebElement) { activeElement = new EyesRemoteWebElement(logger, eyesDriver, activeElement); control = ((EyesRemoteWebElement)activeElement).getBounds(); } for(CharSequence keys : charSequences) { String text = String.valueOf(keys); eyesDriver.getEyes().addTextTrigger(control, text); } keyboard.sendKeys(charSequences); }
public LabelsDialog addLabelUsingEnterKey(String label) { typeInLabelsInput(label); driver.getKeyboard().sendKeys(RETURN); waitUntilTrue("New label should be visible", getLabelSection().hasLabelCondition(label)); return this; }
public void sendKeys(CharSequence... keysToSend) { verifyCanInteractWithElement(); // Handle special input types String typeAttribute = getAttribute("type"); if (typeAttribute != null) { typeAttribute = typeAttribute.toLowerCase(); if (getTagName().equals("INPUT") && SPECIAL_INPUTS.contains(typeAttribute)) { if (typeAttribute.equals("file")) { File localFile = fileDetector.getLocalFile(keysToSend); if (localFile != null) { debugger.setFormElementValue(objectId, localFile.getAbsolutePath()); } } else { debugger.setFormElementValue(objectId, Joiner.on("").join(keysToSend)); } return; } } parent.getScopeServices().captureOperaIdle(); switchFocusToThisIfNeeded(); parent.getKeyboard().sendKeys(keysToSend); try { parent.waitForLoadToComplete(); } catch (ResponseNotReceivedException e) { // return control to user } }
@Test public void testGrapheneElementActionWriteIntoElement() { // when grapheneElement.writeIntoElement("hi"); // then verify(mouse).mouseMove(((Locatable) grapheneElement).getCoordinates()); verify(mouse).click(((Locatable) grapheneElement).getCoordinates()); verify(keyboard).sendKeys("hi"); verifyNoMoreInteractions(mouse, keyboard); } }
@Test public void testGrapheneActionWriteIntoElement() { // when Graphene.writeIntoElement(webElement, "hi"); // then verify(mouse).mouseMove(((Locatable) webElement).getCoordinates()); verify(mouse).click(((Locatable) webElement).getCoordinates()); verify(keyboard).sendKeys("hi"); verifyNoMoreInteractions(mouse, keyboard); } }