Package org.openqa.selenium

Examples of org.openqa.selenium.Dimension


     * @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


        }
    }

    private Point getPossibleCoordinationsForMouseOut(WebElement element) {
        Locations l = Utils.getLocations(element);
        Dimension size = driver.manage().window().getSize();
        // the mouse will be in the middle of the element, these values will be used for counting the final distance
        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

    public void prepare(@Observes AfterDroneEnhanced event) {

        WebDriver browser = event.getInstance().asInstance(WebDriver.class);
        if (BrowserUtils.isPhantomjs(browser)) {
            browser.manage().window().setSize(new Dimension(1280, 1024));
        }
    }
View Full Code Here

  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 new Point(0, 0);
  }

  public Dimension getSize() {
    if(is_not_null(_webElement)) {
      Dimension value = _webElement.getSize();
      info("Element '" + super.name() + "' - Dimention is '" + value + "'");
      return value;
    } else {
      info("Element '" + super.name() + "' - has a null _webelement, cannot do getSize()");
    }
    return new Dimension(0, 0);
  }
View Full Code Here

  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 new Point(0, 0);
  }

  public Dimension getSize() {
    if(is_not_null(_webElement)) {
      Dimension value = _webElement.getSize();
      info("Element '" + super.name() + "' - Dimention is '" + value + "'");
      return value;
    } else {
      info("Element '" + super.name() + "' - has a null _webelement, cannot do getSize()");
    }
    return new Dimension(0, 0);
  }
View Full Code Here

    // put in map
    if (!stateCandidatesMap.containsKey(state.getName())) {
      stateCandidatesMap.put(state.getName(), new ArrayList<RenderedCandidateElement>());
    }
    Point location = webElement.getLocation();
    Dimension size = webElement.getSize();
    RenderedCandidateElement renderedCandidateElement =
    // TODO Check if element.getIdentification().getValue() is correct replacement for
    // element.getXpath()
            new RenderedCandidateElement(element.getElement(), element.getIdentification()
                    .getValue(), location, size);
View Full Code Here

  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 new Point(0, 0);
  }

  public Dimension getSize() {
    if(is_not_null(_webElement)) {
      Dimension value = _webElement.getSize();
      info("Element '" + super.name() + "' - Dimention is '" + value + "'");
      return value;
    } else {
      info("Element '" + super.name() + "' - has a null _webelement, cannot do getSize()");
    }
    return new Dimension(0, 0);
  }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.Dimension

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.