@Override public void sendKeys(CharSequence... keysToSend) { ensureWebDriver(); delegateKeyboard().sendKeys(keysToSend); }
Keyboard keyboard = //instantiate implementation here driver.findElement(By.id("Email")).click(); keyboard.pressKey("Type whatever you want here");
Actions a=new Actions(driver); a.moveToElement(driver.findElement(By.name("yourlocator"))).build().perform(); Keyboard h=((HasInputDevices)driver).getKeyboard(); h.pressKey(Keys.ENTER); h.releaseKey(Keys.ENTER);
public void releaseKey(CharSequence keyToRelease) { keyboard.releaseKey(keyToRelease); } }
@Override Element perform(Object actionExecutor, Element lastProcessedElement, Map<String, Object> descriptor) { ((Keyboard) actionExecutor).releaseKey((CharSequence) descriptor.get("value")); return lastProcessedElement; } },
public void perform() { focusOnElement(); keyboard.sendKeys(keysToSend); }
public void pressKey(CharSequence keyToPress) { keyboard.pressKey(keyToPress); }
@Override public void releaseKey(CharSequence keyToRelease) { ensureWebDriver(); delegateKeyboard().releaseKey(keyToRelease); }
@Override protected void doPerform() { if (isSourceDocumentRoot()) { keyboard().sendKeys(keys); } else { getFirstElement().sendKeys(keys); } } }
@Override Element perform(Object actionExecutor, Element lastProcessedElement, Map<String, Object> descriptor) { ((Keyboard) actionExecutor).pressKey((CharSequence) descriptor.get("value")); return lastProcessedElement; } },
public void perform() { focusOnElement(); keyboard.releaseKey(key); }
/** * 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); }
public void perform() { focusOnElement(); keyboard.pressKey(key); }
@Override protected void doPerform() { org.openqa.selenium.Keys seleniumKeys = org.openqa.selenium.Keys.getKeyFromUnicode(keys.getKeyCode()); if (isSourceDocumentRoot()) { keyboard().releaseKey(seleniumKeys); } else { getActions().keyUp(getFirstElement(), seleniumKeys).perform(); } } }
@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); } }
@Override public void pressKey(CharSequence keyToPress) { ensureWebDriver(); delegateKeyboard().pressKey(keyToPress); }
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 void selectReturn() { Keyboard keyboard = driver.getKeyboard(); keyboard.pressKey(Keys.RETURN); }
public LabelsDialog addLabelUsingEnterKey(String label) { typeInLabelsInput(label); driver.getKeyboard().sendKeys(RETURN); waitUntilTrue("New label should be visible", getLabelSection().hasLabelCondition(label)); return this; }
public void selectEnter() { Keyboard keyboard = driver.getKeyboard(); keyboard.pressKey(Keys.ENTER); }