本文整理了Java中org.openqa.selenium.interactions.Keyboard
类的一些代码示例,展示了Keyboard
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Keyboard
类的具体详情如下:
包路径:org.openqa.selenium.interactions.Keyboard
类名称:Keyboard
[英]Interface representing basic, low-level keyboard operations. It offers a set of low-level "do as I say" commands to allow precise emulation of user input.
[中]表示基本低级键盘操作的接口。它提供了一组低级的“照我说的做”命令,允许精确模拟用户输入。
代码示例来源:origin: viltgroup/minium
@Override
public void sendKeys(CharSequence... keysToSend) {
ensureWebDriver();
delegateKeyboard().sendKeys(keysToSend);
}
代码示例来源:origin: stackoverflow.com
Keyboard keyboard = //instantiate implementation here
driver.findElement(By.id("Email")).click();
keyboard.pressKey("Type whatever you want here");
代码示例来源:origin: stackoverflow.com
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);
代码示例来源:origin: com.applitools/eyes-selenium-java3
public void releaseKey(CharSequence keyToRelease) {
keyboard.releaseKey(keyToRelease);
}
}
代码示例来源:origin: com.machinepublishers/jbrowserdriver
@Override
Element perform(Object actionExecutor, Element lastProcessedElement, Map<String, Object> descriptor) {
((Keyboard) actionExecutor).releaseKey((CharSequence) descriptor.get("value"));
return lastProcessedElement;
}
},
代码示例来源:origin: org.seleniumhq.selenium/selenium-api
public void perform() {
focusOnElement();
keyboard.sendKeys(keysToSend);
}
代码示例来源:origin: com.applitools/eyes-selenium-java3
public void pressKey(CharSequence keyToPress) {
keyboard.pressKey(keyToPress);
}
代码示例来源:origin: viltgroup/minium
@Override
public void releaseKey(CharSequence keyToRelease) {
ensureWebDriver();
delegateKeyboard().releaseKey(keyToRelease);
}
代码示例来源:origin: viltgroup/minium
@Override
protected void doPerform() {
if (isSourceDocumentRoot()) {
keyboard().sendKeys(keys);
} else {
getFirstElement().sendKeys(keys);
}
}
}
代码示例来源:origin: com.machinepublishers/jbrowserdriver
@Override
Element perform(Object actionExecutor, Element lastProcessedElement, Map<String, Object> descriptor) {
((Keyboard) actionExecutor).pressKey((CharSequence) descriptor.get("value"));
return lastProcessedElement;
}
},
代码示例来源:origin: org.seleniumhq.selenium/selenium-api
public void perform() {
focusOnElement();
keyboard.releaseKey(key);
}
代码示例来源:origin: org.xwiki.platform/xwiki-platform-test-ui
/**
* 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);
}
代码示例来源:origin: org.seleniumhq.selenium/selenium-api
public void perform() {
focusOnElement();
keyboard.pressKey(key);
}
代码示例来源:origin: viltgroup/minium
@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();
}
}
}
代码示例来源:origin: com.infotel.seleniumRobot/core
@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);
}
}
代码示例来源:origin: viltgroup/minium
@Override
public void pressKey(CharSequence keyToPress) {
ensureWebDriver();
delegateKeyboard().pressKey(keyToPress);
}
代码示例来源:origin: com.applitools/eyes-selenium-java3
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);
}
代码示例来源:origin: com.atlassian.confluence/confluence-webdriver-pageobjects
public void selectReturn() {
Keyboard keyboard = driver.getKeyboard();
keyboard.pressKey(Keys.RETURN);
}
代码示例来源:origin: com.atlassian.confluence/confluence-webdriver-pageobjects
public LabelsDialog addLabelUsingEnterKey(String label) {
typeInLabelsInput(label);
driver.getKeyboard().sendKeys(RETURN);
waitUntilTrue("New label should be visible", getLabelSection().hasLabelCondition(label));
return this;
}
代码示例来源:origin: com.atlassian.confluence/confluence-webdriver-pageobjects
public void selectEnter() {
Keyboard keyboard = driver.getKeyboard();
keyboard.pressKey(Keys.ENTER);
}
内容来源于网络,如有侵权,请联系作者删除!