Package org.openqa.selenium

Examples of org.openqa.selenium.Dimension


    State state = getStateByFileName("a.html");
    assertThat(state, is(notNullValue()));
    List<CandidateElementPosition> candidates = state.getCandidateElements();
    assertThat(candidates, hasSize(1));
    Assume.assumeTrue(resolutionBigEnough);
    assertThat(candidates, hasItem(element(new Point(58, 147), new Dimension(89, 16))));
  }
View Full Code Here


    State state = getStateByFileName("b.html");
    assertThat(state, is(notNullValue()));
    List<CandidateElementPosition> candidates = state.getCandidateElements();
    assertThat(candidates, hasSize(1));
    Assume.assumeTrue(resolutionBigEnough);
    assertThat(candidates, hasItem(element(new Point(60, 168), new Dimension(51, 16))));
  }
View Full Code Here

        open(MENUTEST_ATTACHTOBODY_APP);
        String menuItem3 = "actionItemAttachToBody3";
        WebDriver driver = this.getDriver();
        WebElement actionItem3 = driver.findElement(By.className(menuItem3));
        // Need to make the screen bigger so WebDriver doesn't need to scroll
        driver.manage().window().setSize(new Dimension(1366, 768));
        String trigger = "triggerAttachToBody";
        String menuList = "actionMenuAttachToBody";
        String triggerGlobalId = auraUITestingUtil.getCmpGlobalIdGivenElementClassName(trigger);
        String menuListGlobalId = auraUITestingUtil.getCmpGlobalIdGivenElementClassName(menuList);
        WebElement menuLabel = driver.findElement(By.className(trigger));
        WebElement menu = driver.findElement(By.className(menuList));
        menuLabel.click();
        assertTrue("Action Menu list should be expanded", menu.getAttribute("class").contains("visible"));
        verifyMenuPositionedCorrectly(triggerGlobalId, menuListGlobalId,
                "Menu List is not positioned correctly when the menuList rendered on the page");
        String triggerLeftPosBeforeClick = auraUITestingUtil.getBoundingRectPropOfElement(triggerGlobalId, "left");
        actionItem3.click();
        String triggerLeftPosAfterClickOnItem2 = auraUITestingUtil
                .getBoundingRectPropOfElement(triggerGlobalId, "left");
        assertEquals("Menu Item position changed after clicking on Item2", triggerLeftPosBeforeClick,
                triggerLeftPosAfterClickOnItem2);

        int currentWidth = driver.manage().window().getSize().width;
        int currentHeight = driver.manage().window().getSize().height;
        driver.manage().window().setSize(new Dimension(currentWidth - 200, currentHeight - 100));
        verifyMenuPositionedCorrectly(triggerGlobalId, menuListGlobalId,
                "Menu List is not positioned correctly after the resize");
    }
View Full Code Here

            }
            capabilities.setCapability(WebDriverProvider.REUSE_BROWSER_PROPERTY, reuseBrowser);

            addPerfCapabilities(capabilities);

            Dimension windowSize = getWindowSize();
            if (currentBrowserType == BrowserType.GOOGLECHROME) {
                WebDriverUtil.addChromeOptions(capabilities, windowSize);
            }

            logger.info(String.format("Requesting: %s", capabilities));
View Full Code Here

    }

    @Override
    protected final Dimension getWindowSize() {
        // use same size as OnePhoneContext.java: 548x320 (1/2 iPhone 5?)
        return new Dimension(320, 548);
    }
View Full Code Here

        createAndSaveThumbnail(file, 0, element);
    }

    public void createAndSaveThumbnail(File file, int index, WebElement element) {
        Point centerPoint = getCenter(element);
        Dimension elementDimension = element.getSize();
        BufferedImage image = loadImage(file);
        if (centerPoint != null) {
            Point cropPoint = findImageCropPoint(centerPoint, image);
            int cropWidth = thumbnailWidth;
            int cropHeight = thumbnailHeight;

            if (elementDimension.getWidth() > thumbnailWidth) {
                int newXPoint = cropPoint.getX() - (elementDimension.getWidth() / 2);
                if (newXPoint < 0) {
                    newXPoint = 0;
                }
                cropPoint = new Point(newXPoint, cropPoint.getY());
            }
View Full Code Here

        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

  }

  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()
            new CandidateElementPosition(element.getIdentification().getValue(),
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(),
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

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.