Package org.openqa.selenium

Examples of org.openqa.selenium.Point


        "//UIAStaticText[contains(@name, 'scale: 0.011 - velocity: 0.000')]").isDisplayed());
  }

  @Test
  public void testPinchOpen() {
    Point openFrom = new Point(856, 612);
    Point openTo = new Point(756, 612);

    IOSTouchScreen iosTouchScreen = IOSDriverAugmenter.augment(driver);
    iosTouchScreen.pinchOpenFromToForDuration(openFrom, openTo, 1);

    waitForElement(driver, By.xpath("//UIAStaticText[contains(@name, 'scale: 10.000')]"), 6);
View Full Code Here


      public Object invoke(ExecuteMethod exec, Object self, Method method, Object... args) {
        RemoteWebDriver driver = (RemoteWebDriver) self;
        WebDriverLikeCommandExecutor executor = new WebDriverLikeCommandExecutor(driver);

        if ("dragFromToForDuration".equals(method.getName())) {
          Point from = (Point) args[0];
          Point to = (Point) args[1];
          int duration = (Integer) args[2];
          RemoteIOSDriver.dragFromToForDuration(executor, from, to, duration);
          return null;
        } else if ("pinchCloseFromToForDuration".equals(method.getName())) {
          Point from = (Point) args[0];
          Point to = (Point) args[1];
          int duration = (Integer) args[2];
          RemoteIOSDriver.pinchCloseFromToForDuration(executor, from, to, duration);
          return null;
        } else if ("pinchOpenFromToForDuration".equals(method.getName())) {
          Point from = (Point) args[0];
          Point to = (Point) args[1];
          int duration = (Integer) args[2];
          RemoteIOSDriver.pinchOpenFromToForDuration(executor, from, to, duration);
          return null;
        } else {
          throw new WebDriverException(method.getName() + " isn't recognized for IOSTouchScreen");
View Full Code Here

    Map<String, Long> origin = (Map<String, Long>) rect.get("origin");

    Long x = origin.get("x");
    Long y = origin.get("y");

    Point res = new Point(x.intValue(), y.intValue());
    return res;

  }
View Full Code Here

     *
     * @see Locations
     */
    public static Locations getLocations(WebElement root) {
        Preconditions.checkNotNull(root, "The element cannot be null.");
        Point topLeft = root.getLocation();
        Dimension dimension = root.getSize();
        Point topRight = topLeft.moveBy(dimension.getWidth(), 0);
        Point bottomRight = topRight.moveBy(0, dimension.getHeight());
        Point bottomLeft = topLeft.moveBy(0, dimension.getHeight());
        return new Locations(topLeft, topRight, bottomLeft, bottomRight);
    }
View Full Code Here

     * Asserts that two locations are equal with some allowed tolerance.
     */
    public static void tolerantAssertLocationsEquals(Locations l1, Locations l2, int xTolerance, int yTolerance, String message) {
        Iterator<Point> it1 = l1.iterator();
        Iterator<Point> it2 = l2.iterator();
        Point p1, p2;
        while (it1.hasNext()) {
            p1 = it1.next();
            p2 = it2.next();
            if (!_tolerantAssertPointEquals(p1, p2, xTolerance, yTolerance)) {
                throw new AssertionError("The locations are not equal or are not in tolerance.\n" + "First location: " + l1
View Full Code Here

        } else if (event.equals(Event.MOUSEMOVE)) {
            return moveToElement(element);
        } else if (event.equals(Event.CONTEXTCLICK) || event.equals(Event.CONTEXTMENU)) {
            return contextClick(element);
        } else if (event.equals(Event.MOUSEOUT)) {
            Point coords = getPossibleCoordinationsForMouseOut(element);
            return moveToElement(element).moveByOffset(coords.x, coords.y);
        } else if (event.equals(Event.MOUSEOVER)) {
            return moveToElement(element, 1, 1);
        } else if (event.equals(Event.MOUSEUP)) {
            return clickAndHold(element).release();
View Full Code Here

        int halfWidth = l.getWidth() / 2;
        int halfHeight = l.getHeight() / 2;
        int movementDistance = 10;// distance from the element in pixels
        // check whether position left from the Element is valid
        Locations moved = l.moveAllBy(-movementDistance, 0);
        Point point = moved.getTopLeft();
        if (point.x > 0) {
            return new Point(-halfWidth - movementDistance, 0);
        }
        // check whether position right from the Element is valid
        moved = l.moveAllBy(movementDistance, 0);
        point = moved.getTopRight();
        if (point.x < size.getWidth()) {
            return new Point(halfWidth + movementDistance, 0);
        }
        // check whether position up from the Element is valid
        moved = l.moveAllBy(0, -movementDistance);
        point = moved.getTopRight();
        if (point.y > 0) {
            return new Point(0, -halfHeight - movementDistance);
        }
        // check whether position down from the Element is valid
        moved = l.moveAllBy(0, movementDistance);
        point = moved.getBottomRight();
        if (point.y > size.getHeight()) {
            return new Point(0, halfHeight + movementDistance);
        }
        throw new RuntimeException("Cannot find any suitable position for mouseout event.");
    }
View Full Code Here

   * NOTE: This method is still under development.
   * @return
   */
  public String static_info() {
    String info = "";
    Point point = getLocation();
    info += "X = " + point.getX();
    info += ", Y = " + point.getY();
    Dimension dimension = getSize();
    info += ", Height = " + dimension.getHeight();
    info += ", Width = " + dimension.getWidth();
    return info;
  }
View Full Code Here

    return elements;
  }
 
  public void move_by(int x, int y) {
    takeScreenshot();
    Point current_location = getLocation();
    action("Current position of element '" + current_location + "', Moving by (x, y) = (" + x + ", " + y + ")");
   
    Actions drag = new Actions(browser.driver());
    try {
      drag.dragAndDropBy(_nativeWebElement(), x, y).build().perform();
      Point new_location = getLocation();
      action("New position of element '" + new_location + "', Moved by (x, y) = (" + x + ", " + y + ")");
    } catch (org.openqa.selenium.interactions.MoveTargetOutOfBoundsException mtoobe) {
      error("Cannot move element '" + current_location + "', to (x, y) = (" + x + ", " + y + "), got org.openqa.selenium.interactions.MoveTargetOutOfBoundsException");
    }
   
View Full Code Here

    takeScreenshot();
  }
 
  public void move_to(int x, int y) {
    takeScreenshot();
    Point current_location = getLocation();
    int offset_x = x - current_location.getX();
    int offset_y = y - current_location.getY();
   
    action("Current position of element '" + current_location + "', Moving to (x, y) = (" + x + ", " + y + ")");
    Actions drag = new Actions(browser.driver());
    try {
      drag.dragAndDropBy(_nativeWebElement(), offset_x, offset_y).build().perform();
      Point new_location = getLocation();
      action("New position of element '" + new_location + "', Moved to (x, y) = (" + x + ", " + y + ")");
    } catch (org.openqa.selenium.interactions.MoveTargetOutOfBoundsException mtoobe) {
      error("Cannot move element '" + current_location + "', to (x, y) = (" + x + ", " + y + "), got org.openqa.selenium.interactions.MoveTargetOutOfBoundsException");
    }
   
View Full Code Here

TOP

Related Classes of org.openqa.selenium.Point

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.