org.openqa.selenium.interactions.Keyboard Java Examples

The following examples show how to use org.openqa.selenium.interactions.Keyboard. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DelegatingWebDriver.java    From vividus with Apache License 2.0 5 votes vote down vote up
@Override
public Keyboard getKeyboard()
{
    if (wrappedDriver instanceof HasInputDevices)
    {
        return ((HasInputDevices) wrappedDriver).getKeyboard();
    }
    throw new UnsupportedOperationException(ADVANCED_INTERACTION_NOT_SUPPORTED);
}
 
Example #2
Source File: DelegatingWebDriverTests.java    From vividus with Apache License 2.0 5 votes vote down vote up
@Test
void testGetKeyboard()
{
    WebDriver driverWithInputDevices = Mockito.mock(WebDriver.class,
            withSettings().extraInterfaces(HasInputDevices.class));
    Keyboard keyboard = Mockito.mock(Keyboard.class);
    when(((HasInputDevices) driverWithInputDevices).getKeyboard()).thenReturn(keyboard);
    assertEquals(keyboard, new DelegatingWebDriver(driverWithInputDevices).getKeyboard());
}
 
Example #3
Source File: DeviceWebDriver.java    From xframium-java with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Keyboard getKeyboard()
{
    setLastAction();
    if ( webDriver instanceof HasInputDevices )
        return ((HasInputDevices) webDriver).getKeyboard();
    else
        return null;
}
 
Example #4
Source File: SingleKeyAction.java    From selenium with Apache License 2.0 5 votes vote down vote up
protected SingleKeyAction(Keyboard keyboard, Mouse mouse, Locatable locationProvider, Keys key) {
  super(keyboard, mouse, locationProvider);
  this.key = key;
  boolean isModifier = false;
  for (Keys modifier : MODIFIER_KEYS) {
    isModifier = isModifier || modifier.equals(key);
  }

  if (!isModifier) {
    throw new IllegalArgumentException("Key Down / Up events only make sense for modifier keys.");
  }
}
 
Example #5
Source File: EventFiringWebDriver.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Override
public Keyboard getKeyboard() {
  if (driver instanceof HasInputDevices) {
    return new EventFiringKeyboard(driver, dispatcher);
  }
  throw new UnsupportedOperationException("Underlying driver does not implement advanced"
      + " user interactions yet.");
}
 
Example #6
Source File: SendKeyToActiveElement.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Override
public Void call() {
  Keyboard keyboard = ((HasInputDevices) getDriver()).getKeyboard();

  String[] keysToSend = keys.toArray(new String[0]);
  keyboard.sendKeys(keysToSend);

  return null;
}
 
Example #7
Source File: WebDriverDecorator.java    From teasy with MIT License 4 votes vote down vote up
@Override
public Keyboard getKeyboard() {
    return ((HasInputDevices) driver).getKeyboard();
}
 
Example #8
Source File: WebDriverWrapper.java    From jsflight with Apache License 2.0 4 votes vote down vote up
@Override
public Keyboard getKeyboard()
{
    return ((HasInputDevices)driver).getKeyboard();
}
 
Example #9
Source File: SeleniumWebDriver.java    From che with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Keyboard getKeyboard() {
  return driver.getKeyboard();
}
 
Example #10
Source File: SingleKeyAction.java    From selenium with Apache License 2.0 4 votes vote down vote up
protected SingleKeyAction(Keyboard keyboard, Mouse mouse, Keys key) {
  this(keyboard, mouse, null, key);
}
 
Example #11
Source File: KeysRelatedAction.java    From selenium with Apache License 2.0 4 votes vote down vote up
protected KeysRelatedAction(Keyboard keyboard, Mouse mouse, Locatable locationProvider) {
  super(locationProvider);
  this.keyboard = keyboard;
  this.mouse = mouse;
}
 
Example #12
Source File: RemoteWebDriver.java    From selenium with Apache License 2.0 4 votes vote down vote up
@Override
public Keyboard getKeyboard() {
  return keyboard;
}
 
Example #13
Source File: StubDriver.java    From selenium with Apache License 2.0 4 votes vote down vote up
@Override
public Keyboard getKeyboard() {
  return null;
}
 
Example #14
Source File: QAFWebDriver.java    From qaf with MIT License votes vote down vote up
Keyboard getKeyboard();