类org.openqa.selenium.interactions.Coordinates源码实例Demo

下面列出了怎么用org.openqa.selenium.interactions.Coordinates的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: selenium   文件: DefaultFieldDecoratorTest.java
@Test
public void testDecoratingProxyImplementsRequiredInterfaces() {
  final AllDriver driver = mock(AllDriver.class);
  final AllElement element = mock(AllElement.class);
  final Mouse mouse = mock(Mouse.class);

  when(driver.getMouse()).thenReturn(mouse);
  when(element.getCoordinates()).thenReturn(mock(Coordinates.class));
  when(driver.findElement(By.id("foo"))).thenReturn(element);

  Page page = new Page();
  PageFactory.initElements(driver, page);
  new Actions(driver).moveToElement(page.foo).build().perform();

  verify(driver).getKeyboard();
  verify(driver).getMouse();
  verify(element).getCoordinates();
  verify(mouse).mouseMove(any(Coordinates.class));
}
 
源代码2 项目: selenium   文件: MouseMoveToLocation.java
@Override
public Void call() {
  Mouse mouse = ((HasInputDevices) getDriver()).getMouse();

  Coordinates elementLocation = null;
  if (elementProvided) {
    WebElement element = getKnownElements().get(elementId);
    elementLocation = ((Locatable) element).getCoordinates();
  }

  if (offsetsProvided) {
    mouse.mouseMove(elementLocation, xOffset, yOffset);
  } else {
    mouse.mouseMove(elementLocation);
  }
  return null;
}
 
源代码3 项目: vividus   文件: DelegatingWebElementTests.java
@Test
void testGetCoordinates()
{
    WebElement locatableWebElement = Mockito.mock(WebElement.class,
            withSettings().extraInterfaces(Locatable.class));
    Coordinates coordinates = Mockito.mock(Coordinates.class);
    when(((Locatable) locatableWebElement).getCoordinates()).thenReturn(coordinates);
    DelegatingWebElement locatableDelegatingWebElement = new DelegatingWebElement(locatableWebElement);
    assertEquals(coordinates, locatableDelegatingWebElement.getCoordinates());
}
 
源代码4 项目: vividus   文件: MouseActionsTests.java
@Test
void clickInvisibleElement()
{
    when(webDriverProvider.get()).thenReturn(webDriver);
    when(((HasInputDevices) webDriver).getMouse()).thenReturn(mouse);
    Coordinates coordinates = mock(Coordinates.class);
    when(((Locatable) locatableWebElement).getCoordinates()).thenReturn(coordinates);
    mouseActions.moveToAndClick(locatableWebElement);
    verify(mouse).mouseMove(coordinates);
    verify(mouse).click(null);
}
 
源代码5 项目: vividus   文件: MouseActionsTests.java
@Test
void testContextClick()
{
    when(webDriverProvider.get()).thenReturn(webDriver);
    when(((HasInputDevices) webDriver).getMouse()).thenReturn(mouse);
    Coordinates coordinates = mock(Coordinates.class);
    when(((Locatable) locatableWebElement).getCoordinates()).thenReturn(coordinates);
    mouseActions.contextClick(locatableWebElement);
    verify(mouse).contextClick(coordinates);
}
 
源代码6 项目: vividus   文件: MouseActionsTests.java
@Test
void testMoveToElement()
{
    when(webDriverProvider.get()).thenReturn(webDriver);
    when(((HasInputDevices) webDriver).getMouse()).thenReturn(mouse);
    Coordinates coordinates = mock(Coordinates.class);
    when(((Locatable) locatableWebElement).getCoordinates()).thenReturn(coordinates);
    mouseActions.moveToElement(locatableWebElement);
    verify(mouse).mouseMove(coordinates);
}
 
源代码7 项目: vividus   文件: MouseActionsTests.java
@Test
void testMoveToElementMoveTargetOutOfBoundsException()
{
    when(webDriverProvider.get()).thenReturn(webDriver);
    when(((HasInputDevices) webDriver).getMouse()).thenReturn(mouse);
    MoveTargetOutOfBoundsException boundsException = new MoveTargetOutOfBoundsException(
            COULD_NOT_MOVE_TO_ERROR_MESSAGE);
    Coordinates coordinates = mock(Coordinates.class);
    when(((Locatable) locatableWebElement).getCoordinates()).thenReturn(coordinates);
    doThrow(boundsException).when(mouse).mouseMove(coordinates);
    mouseActions.moveToElement(locatableWebElement);
    verify(softAssert).recordFailedAssertion(COULD_NOT_MOVE_TO_ERROR_MESSAGE + boundsException);
}
 
源代码8 项目: selenium   文件: MouseAction.java
protected Coordinates getActionLocation() {
  if (where == null) {
    return null;
  }

  return where.getCoordinates();
}
 
源代码9 项目: selenium   文件: RemoteTouchScreen.java
@Override
public void scroll(Coordinates where, int xOffset, int yOffset) {
  Map<String, Object> scrollParams = paramsFromCoordinates(where);
  scrollParams.put("xoffset", xOffset);
  scrollParams.put("yoffset", yOffset);
  executeMethod.execute(DriverCommand.TOUCH_SCROLL, scrollParams);
}
 
源代码10 项目: selenium   文件: RemoteTouchScreen.java
@Override
public void flick(Coordinates where, int xOffset, int yOffset, int speed) {
  Map<String, Object> flickParams = paramsFromCoordinates(where);
  flickParams.put("xoffset", xOffset);
  flickParams.put("yoffset", yOffset);
  flickParams.put("speed", speed);
  executeMethod.execute(DriverCommand.TOUCH_FLICK, flickParams);
}
 
源代码11 项目: selenium   文件: RemoteTouchScreen.java
private static Map<String, Object> paramsFromCoordinates(Coordinates where) {
  Map<String, Object> params = new HashMap<>();

  if (where != null) {
    String id = (String) where.getAuxiliary();
    params.put("element", id);
  }

  return params;
}
 
源代码12 项目: selenium   文件: RemoteMouse.java
protected Map<String, Object> paramsFromCoordinates(Coordinates where) {
  Map<String, Object> params = new HashMap<>();

  if (where != null) {
    String id = (String) where.getAuxiliary();
    params.put("element", id);
  }

  return params;
}
 
源代码13 项目: selenium   文件: RemoteMouse.java
@Override
public void mouseMove(Coordinates where, long xOffset, long yOffset) {
  Map<String, Object> moveParams = paramsFromCoordinates(where);
  moveParams.put("xoffset", xOffset);
  moveParams.put("yoffset", yOffset);

  executor.execute(DriverCommand.MOVE_TO, moveParams);
}
 
源代码14 项目: selenium   文件: RemoteWebElement.java
@Override
public Coordinates getCoordinates() {
  return new Coordinates() {

    @Override
    public Point onScreen() {
      throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public Point inViewPort() {
      Response response = execute(DriverCommand.GET_ELEMENT_LOCATION_ONCE_SCROLLED_INTO_VIEW(getId()));

      @SuppressWarnings("unchecked")
      Map<String, Number> mapped = (Map<String, Number>) response.getValue();
      return new Point(mapped.get("x")
                             .intValue(), mapped.get("y")
                                                .intValue());
    }

    @Override
    public Point onPage() {
      return getLocation();
    }

    @Override
    public Object getAuxiliary() {
      return getId();
    }
  };
}
 
源代码15 项目: selenium   文件: SingleTapOnElement.java
@Override
public Void call() {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();
  WebElement element = getKnownElements().get(elementId);
  Coordinates elementLocation = ((Locatable) element).getCoordinates();

  touchScreen.singleTap(elementLocation);

  return null;
}
 
源代码16 项目: selenium   文件: Flick.java
@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;
}
 
源代码17 项目: selenium   文件: DoubleTapOnElement.java
@Override
public Void call() {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();
  WebElement element = getKnownElements().get(elementId);
  Coordinates elementLocation = ((Locatable) element).getCoordinates();

  touchScreen.doubleTap(elementLocation);

  return null;
}
 
源代码18 项目: selenium   文件: LongPressOnElement.java
@Override
public Void call() {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();
  WebElement element = getKnownElements().get(elementId);
  Coordinates elementLocation = ((Locatable) element).getCoordinates();
  touchScreen.longPress(elementLocation);

  return null;
}
 
源代码19 项目: selenium   文件: Scroll.java
@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;
}
 
源代码20 项目: vividus   文件: DelegatingWebElement.java
@Override
public Coordinates getCoordinates()
{
    return ((Locatable) wrappedElement).getCoordinates();
}
 
源代码21 项目: teasy   文件: BaseTeasyElement.java
@Override
public Coordinates getCoordinates() {
    return ((org.openqa.selenium.interactions.Locatable) getWrappedWebElement()).getCoordinates();
}
 
源代码22 项目: bobcat   文件: BobcatWebElement.java
@Override
public Coordinates getCoordinates() {
  return locatable.getCoordinates();
}
 
源代码23 项目: selenium   文件: DisplayAction.java
protected Coordinates getActionLocation() {
  return (where == null) ? null : where.getCoordinates();
}
 
源代码24 项目: selenium   文件: EventFiringWebDriver.java
@Override
public Coordinates getCoordinates() {
  return ((Locatable) underlyingElement).getCoordinates();
}
 
源代码25 项目: selenium   文件: EventFiringMouse.java
@Override
public void click(Coordinates where) {
  mouse.click(where);
}
 
源代码26 项目: selenium   文件: EventFiringMouse.java
@Override
public void doubleClick(Coordinates where) {
  mouse.doubleClick(where);
}
 
源代码27 项目: selenium   文件: EventFiringMouse.java
@Override
public void mouseDown(Coordinates where) {
  mouse.mouseDown(where);
}
 
源代码28 项目: selenium   文件: EventFiringMouse.java
@Override
public void mouseUp(Coordinates where) {
  mouse.mouseUp(where);
}
 
源代码29 项目: selenium   文件: EventFiringMouse.java
@Override
public void mouseMove(Coordinates where) {
  mouse.mouseMove(where);
}
 
源代码30 项目: selenium   文件: EventFiringMouse.java
@Override
public void mouseMove(Coordinates where, long xOffset, long yOffset) {
  mouse.mouseMove(where, xOffset, yOffset);
}
 
 类所在包
 类方法
 同包方法