本文整理了Java中org.openqa.selenium.interactions.Keyboard.pressKey()
方法的一些代码示例,展示了Keyboard.pressKey()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Keyboard.pressKey()
方法的具体详情如下:
包路径:org.openqa.selenium.interactions.Keyboard
类名称:Keyboard
方法名:pressKey
[英]Press a key on the keyboard that isn't text. Please see org.openqa.selenium.Keys for an exhaustive list of recognized pressable keys. If keyToPress
is a sequence of characters, different driver implementations may choose to throw an exception or to read only the first character in the sequence.
[中]按键盘上非文本的键。请参阅org。openqa。硒。按键以获取可识别按键的详尽列表。如果keyToPress
是一个字符序列,不同的驱动程序实现可能会选择抛出异常或只读取序列中的第一个字符。
代码示例来源:origin: stackoverflow.com
Keyboard keyboard = //instantiate implementation here
driver.findElement(By.id("Email")).click();
keyboard.pressKey("Type whatever you want here");
代码示例来源:origin: com.applitools/eyes-selenium-java3
public void pressKey(CharSequence keyToPress) {
keyboard.pressKey(keyToPress);
}
代码示例来源: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: 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 void selectEnter() {
Keyboard keyboard = driver.getKeyboard();
keyboard.pressKey(Keys.ENTER);
}
代码示例来源:origin: org.seleniumhq.selenium/selenium-api
public void perform() {
focusOnElement();
keyboard.pressKey(key);
}
代码示例来源:origin: viltgroup/minium
@Override
public void pressKey(CharSequence keyToPress) {
ensureWebDriver();
delegateKeyboard().pressKey(keyToPress);
}
代码示例来源:origin: com.atlassian.confluence/confluence-webdriver-pageobjects
public void press(final Keys key) {
driver.getKeyboard().pressKey(key);
}
代码示例来源:origin: com.atlassian.confluence/confluence-webdriver-pageobjects
public void typeEditComment(String comment) {
driver.getKeyboard().pressKey(comment);
}
代码示例来源: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.atlassian.confluence/confluence-webdriver-pageobjects
public void addCommentShortcutNotSave(String shortcut, boolean shouldShowPopup, int itemIndex) {
driver.getKeyboard().pressKey(shortcut);
By autoCompleteTrigger = By.id("autocomplete-trigger");
if (!shouldShowPopup) {
waitUntilFalse("Autocomplete should not be triggered", tinyMceElement.find(autoCompleteTrigger).timed().isVisible());
return;
}
waiter.until().element(autoCompleteTrigger).isVisible(); // Wait until autocomplete triggered
if (itemIndex != -1) {
By byAutocompleteDialog = By.cssSelector(".aui-dropdown.autocomplete");
waiter.until().element(byAutocompleteDialog).isVisible().execute();
WebElement autocompleteDialog = driver.findElement(byAutocompleteDialog);
autocompleteDialog.findElements(By.cssSelector("li")).get(itemIndex).click();
}
}
代码示例来源:origin: viltgroup/minium
@Override
protected void doPerform() {
org.openqa.selenium.Keys seleniumKeys = org.openqa.selenium.Keys.getKeyFromUnicode(keys.getKeyCode());
if (isSourceDocumentRoot()) {
keyboard().pressKey(seleniumKeys);
} else {
getActions().keyDown(getFirstElement(), seleniumKeys).perform();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!