org.openqa.selenium.interactions.TouchScreen Java Examples

The following examples show how to use org.openqa.selenium.interactions.TouchScreen. 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: DelegatingWebDriverTests.java    From vividus with Apache License 2.0 5 votes vote down vote up
@Test
void testGetTouch()
{
    WebDriver driverWithTouchScreen = Mockito.mock(WebDriver.class,
            withSettings().extraInterfaces(HasTouchScreen.class));
    TouchScreen touchScreen = Mockito.mock(TouchScreen.class);
    when(((HasTouchScreen) driverWithTouchScreen).getTouch()).thenReturn(touchScreen);
    assertEquals(touchScreen, new DelegatingWebDriver(driverWithTouchScreen).getTouch());
}
 
Example #2
Source File: Scroll.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Override
public Void call() {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();

  if (elementId != null) {
    WebElement element = getKnownElements().get(elementId);
    Coordinates elementLocation = ((Locatable) element).getCoordinates();
    touchScreen.scroll(elementLocation, xOffset, yOffset);
  } else {
    touchScreen.scroll(xOffset, yOffset);
  }
  return null;
}
 
Example #3
Source File: Move.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Override
public Void call() {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();

  touchScreen.move(x, y);

  return null;
}
 
Example #4
Source File: LongPressOnElement.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Override
public Void call() {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();
  WebElement element = getKnownElements().get(elementId);
  Coordinates elementLocation = ((Locatable) element).getCoordinates();
  touchScreen.longPress(elementLocation);

  return null;
}
 
Example #5
Source File: DoubleTapOnElement.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Override
public Void call() {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();
  WebElement element = getKnownElements().get(elementId);
  Coordinates elementLocation = ((Locatable) element).getCoordinates();

  touchScreen.doubleTap(elementLocation);

  return null;
}
 
Example #6
Source File: Up.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Override
public Void call() {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();

  touchScreen.up(x, y);

  return null;
}
 
Example #7
Source File: Flick.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Override
public Void call() {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();

  if (elementId != null) {
    WebElement element = getKnownElements().get(elementId);
    Coordinates elementLocation = ((Locatable) element).getCoordinates();
    touchScreen.flick(elementLocation, xOffset, yOffset, speed);
  } else {
    touchScreen.flick(xSpeed, ySpeed);
  }

  return null;
}
 
Example #8
Source File: Down.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Override
public Void call() {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();

  touchScreen.down(x, y);

  return null;
}
 
Example #9
Source File: SingleTapOnElement.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Override
public Void call() {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();
  WebElement element = getKnownElements().get(elementId);
  Coordinates elementLocation = ((Locatable) element).getCoordinates();

  touchScreen.singleTap(elementLocation);

  return null;
}
 
Example #10
Source File: EventFiringWebDriver.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Override
 public TouchScreen getTouch() {
   if (driver instanceof HasTouchScreen) {
     return new EventFiringTouch(driver, dispatcher);
   }
   throw new UnsupportedOperationException("Underlying driver does not implement advanced"
       + " user interactions yet.");
}
 
Example #11
Source File: DelegatingWebDriver.java    From vividus with Apache License 2.0 5 votes vote down vote up
@Override
public TouchScreen getTouch()
{
    if (wrappedDriver instanceof HasTouchScreen)
    {
        return ((HasTouchScreen) wrappedDriver).getTouch();
    }
    throw new UnsupportedOperationException(ADVANCED_INTERACTION_NOT_SUPPORTED);
}
 
Example #12
Source File: DeviceWebDriver.java    From xframium-java with GNU General Public License v3.0 5 votes vote down vote up
@Override
public TouchScreen getTouch()
{
    setLastAction();
    if ( webDriver instanceof HasTouchScreen )
        return ((HasTouchScreen) webDriver).getTouch();
    else
        return null;
}
 
Example #13
Source File: UpAction.java    From selenium with Apache License 2.0 4 votes vote down vote up
public UpAction(TouchScreen touchScreen, int x, int y) {
  super(touchScreen, null);
  this.x = x;
  this.y = y;
}
 
Example #14
Source File: AppiumIosTest.java    From candybean with GNU Affero General Public License v3.0 4 votes vote down vote up
public TouchScreen getTouch() {
    return touch;
}
 
Example #15
Source File: SugarAndroidTest.java    From candybean with GNU Affero General Public License v3.0 4 votes vote down vote up
public TouchScreen getTouch() {
    return touch;
}
 
Example #16
Source File: EvernoteAndroidTest.java    From candybean with GNU Affero General Public License v3.0 4 votes vote down vote up
public TouchScreen getTouch() {
	return touch;
}
 
Example #17
Source File: AppiumAndroidTest.java    From candybean with GNU Affero General Public License v3.0 4 votes vote down vote up
public TouchScreen getTouch() {
    return touch;
}
 
Example #18
Source File: SugarAndroidTest.java    From candybean with GNU Affero General Public License v3.0 4 votes vote down vote up
public TouchScreen getTouch() {
    return touch;
}
 
Example #19
Source File: WebDriverInterface.java    From candybean with GNU Affero General Public License v3.0 4 votes vote down vote up
public TouchScreen getTouch() {
	return touch;
}
 
Example #20
Source File: QAFExtendedWebDriver.java    From qaf with MIT License 4 votes vote down vote up
@Override
public TouchScreen getTouchScreen() {
	return new RemoteTouchScreen(getExecuteMethod());
}
 
Example #21
Source File: DoubleTapAction.java    From selenium with Apache License 2.0 4 votes vote down vote up
public DoubleTapAction(TouchScreen touchScreen, Locatable locationProvider) {
  super(touchScreen, locationProvider);
}
 
Example #22
Source File: LongPressAction.java    From selenium with Apache License 2.0 4 votes vote down vote up
public LongPressAction(TouchScreen touchScreen, Locatable locationProvider) {
  super(touchScreen, locationProvider);
}
 
Example #23
Source File: DownAction.java    From selenium with Apache License 2.0 4 votes vote down vote up
public DownAction(TouchScreen touchScreen, int x, int y) {
  super(touchScreen, null);
  this.x = x;
  this.y = y;
}
 
Example #24
Source File: ScrollAction.java    From selenium with Apache License 2.0 4 votes vote down vote up
public ScrollAction(TouchScreen touchScreen, Locatable locationProvider, int x, int y) {
  super(touchScreen, locationProvider);
  xOffset = x;
  yOffset = y;
}
 
Example #25
Source File: StubDriver.java    From selenium with Apache License 2.0 4 votes vote down vote up
@Override
public TouchScreen getTouch() {
  return null;
}
 
Example #26
Source File: ChromiumDriver.java    From selenium with Apache License 2.0 4 votes vote down vote up
@Override
public TouchScreen getTouch() {
  return touchScreen;
}
 
Example #27
Source File: ScrollAction.java    From selenium with Apache License 2.0 4 votes vote down vote up
public ScrollAction(TouchScreen touchScreen, int xOffset, int yOffset) {
  super(touchScreen, null);
  this.xOffset = xOffset;
  this.yOffset = yOffset;
}
 
Example #28
Source File: TouchAction.java    From selenium with Apache License 2.0 4 votes vote down vote up
public TouchAction(TouchScreen touchScreen, Locatable locationProvider) {
  super(locationProvider);
  this.touchScreen = touchScreen;
}
 
Example #29
Source File: FlickAction.java    From selenium with Apache License 2.0 4 votes vote down vote up
public FlickAction(TouchScreen touchScreen, int xSpeed, int ySpeed) {
  super(touchScreen, null);
  this.xSpeed = xSpeed;
  this.ySpeed = ySpeed;
}
 
Example #30
Source File: FlickAction.java    From selenium with Apache License 2.0 4 votes vote down vote up
public FlickAction(TouchScreen touchScreen, Locatable locationProvider, int x, int y, int speed) {
  super(touchScreen, locationProvider);
  xOffset = x;
  yOffset = y;
  this.speed = speed;
}