org.openqa.selenium.interactions.Keyboard.releaseKey()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中org.openqa.selenium.interactions.Keyboard.releaseKey()方法的一些代码示例,展示了Keyboard.releaseKey()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Keyboard.releaseKey()方法的具体详情如下:
包路径:org.openqa.selenium.interactions.Keyboard
类名称:Keyboard
方法名:releaseKey

Keyboard.releaseKey介绍

[英]Release a key on the keyboard that isn't text. Please see org.openqa.selenium.Keys for an exhaustive list of recognized pressable keys. If keyToRelease 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。硒。按键以获取可识别按键的详尽列表。如果keyToRelease是一个字符序列,不同的驱动程序实现可能会选择抛出异常或只读取序列中的第一个字符。

代码示例

代码示例来源: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: viltgroup/minium

@Override
public void releaseKey(CharSequence keyToRelease) {
  ensureWebDriver();
  delegateKeyboard().releaseKey(keyToRelease);
}

代码示例来源:origin: org.seleniumhq.selenium/selenium-api

public void perform() {
 focusOnElement();
 keyboard.releaseKey(key);
}

代码示例来源: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: 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();
    }
  }
}

相关文章