@Override public FluentWebElementAssert hasDimension(Dimension dimension) { Dimension actualSize = actual.size(); if (!actualSize.equals(dimension)) { failWithMessage("The element does not have the same size: " + dimension.toString() + ". Actual size found : " + actualSize.toString()); } return this; }
@Override public FluentListAssert hasDimension(Dimension dimension) { List<Dimension> actualDimensions = actual.dimensions(); checkListEmptiness(actualDimensions); if (!actualDimensions.contains(dimension)) { failWithMessage("No selected elements have dimension: " + dimension.toString() + ". Actual dimensions found : " + actualDimensions.toString()); } return this; }
private static String dimension(WebElement element) { return element.getSize().toString(); }
private static String dimension(WebElement element) { return element.getSize().toString(); }
@Override public FluentWebElementAssert hasDimension(Dimension dimension) { Dimension actualSize = actual.size(); if (!actualSize.equals(dimension)) { failWithMessage("The element does not have the same size: " + dimension.toString() + ". Actual size found : " + actualSize.toString()); } return this; }
@Override public FluentListAssert hasDimension(Dimension dimension) { List<Dimension> actualDimensions = actual.dimensions(); checkListEmptiness(actualDimensions); if (!actualDimensions.contains(dimension)) { failWithMessage("No selected elements have dimension: " + dimension.toString() + ". Actual dimensions found : " + actualDimensions.toString()); } return this; }
@Override public Dimension doGetSize() { Dimension dim = element.getSize(); LOGGER.debug(Messager.ELEMENT_ATTRIBUTE_FOUND.getMessage("Size", dim.toString(), getName())); return dim; }
public void tapAtRelativeCoordinates(double x_offset, double y_offset, int taps, double frequency) throws Exception { Dimension size = driver.manage().window().getSize(); Point middle = new Point(size.getWidth(), size.getHeight()); Point middleWithOffset = new Point(middle.x * x_offset, middle.y * y_offset); log("Tapping at coordinates: " + middleWithOffset.toString() + " when size of the screen is: " + size.toString()); for (int i = 0; i < taps; i++) { if (automationName.equalsIgnoreCase("selendroid")) { selendroidTapAtCoordinate((int) middleWithOffset.x, (int) middleWithOffset.y, 1); } else { driver.tap(1, (int) middleWithOffset.x, (int) middleWithOffset.y, 1); } sleep(frequency); } }
@Keyword("Validate window size") @Parameters(min = 2, max = 4) public void validateWindowSize(int expectedWidth, int expectedHeight, Integer deltaWidth, Integer deltaHeight) { Dimension expected = new Dimension(expectedWidth, expectedHeight); Dimension actual = toolkit.windowInstructions().getWindowSize(); Dimension delta = (deltaWidth == null && deltaHeight == null) ? null : new Dimension( deltaWidth, deltaHeight); boolean flag = SeleniumToolkit.withinRange(expected, actual, delta); publish(new SetStatusEvent(flag)); if (flag == false) { String format = "Window size (%s) not within the specified range"; String error = String.format(format, expected.toString()); log().error(error); } } }