Package org.openqa.selenium

Examples of org.openqa.selenium.Point


        }
        writeThumbnailFileToDisk(file, index, image);
    }

    private Point getCenter(WebElement element) {
        Point topLeft = LocationFinder.getLocation(element);
        Dimension dimension = element.getSize();
        return new Point((topLeft.getX() + (dimension.width / 2)), (topLeft.getY() + (dimension.height / 2)));
    }
View Full Code Here


        Dimension dimension = element.getSize();
        return new Point((topLeft.getX() + (dimension.width / 2)), (topLeft.getY() + (dimension.height / 2)));
    }

    private Point findImageCropPoint(Point centerPoint, BufferedImage image) {
        return new Point(transposeXCoordinate(centerPoint.getX(), image), transposeYCoordinate(centerPoint.getY(), image));
    }
View Full Code Here

    LOG.debug("onNewState");
    StateBuilder state = outModelCache.addStateIfAbsent(vertex);
    visitedStates.putIfAbsent(state.getName(), vertex);
    saveScreenshot(context.getBrowser(), state.getName(), vertex);
    outputBuilder.persistDom(state.getName(), vertex.getDom());
    Point point = getOffSet(context.getBrowser());
    state.setScreenShotOffset(point);
    LOG.debug("{} has a body offset of {}", vertex.getName(), point);
  }
View Full Code Here

      if (bodyHasOffset(embeddedBrowser)) {
        Number top = (Number) embeddedBrowser
                .executeJavaScript("return document.body.getBoundingClientRect().top;");
        Number left = (Number) embeddedBrowser
                .executeJavaScript("return document.body.getBoundingClientRect().left;");
        Point offset = new Point(left.intValue(), top.intValue());
        return offset;
      }
    } catch (CrawljaxException | WebDriverException e) {
      LOG.info("Could not locate relative size of body, now using (0,0) instead");
      LOG.debug("Could not locate relative size of body body because {}", e.getMessage(), e);
    }
    return new Point(0, 0);
  }
View Full Code Here

    }
  }

  private CandidateElementPosition findElement(WebElement webElement,
          CandidateElement element) {
    Point location = webElement.getLocation();
    Dimension size = webElement.getSize();
    CandidateElementPosition renderedCandidateElement =
            // TODO Check if element.getIdentification().getValue() is correct
            // replacement for
            // element.getXpath()
View Full Code Here

    }
  }

  private CandidateElementPosition findElement(WebElement webElement,
          CandidateElement element) {
    Point location = webElement.getLocation();
    Dimension size = webElement.getSize();
    CandidateElementPosition renderedCandidateElement =
            new CandidateElementPosition(element.getIdentification().getValue(),
                    location, size);
    if (location.getY() < 0) {
      LOG.warn("Weird positioning {} for {}", webElement.getLocation(),
              renderedCandidateElement.getXpath());
    }
    return renderedCandidateElement;
  }
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

    return StringUtils.EMPTY;
  }

  public Point getLocation() {
    if(is_not_null(_webElement)) {
      Point value = _webElement.getLocation();
      info("Element '" + super.name() + "' - Location is '" + value + "'");
      return value;
    } else {
      info("Element '" + super.name() + "' - has a null _webelement, cannot do getLocation()");
    }
    return new Point(0, 0);
  }
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.