List of usage examples for org.openqa.selenium WebElement getSize
Dimension getSize();
From source file:org.oneandone.qxwebdriver.ui.mobile.core.WidgetImpl.java
License:LGPL
protected static Point getCenter(WebElement element) { Dimension size = element.getSize(); int halfWidth = size.getWidth() / 2; int halfHeight = size.getHeight() / 2; Point loc = element.getLocation(); int posX = loc.getX() + halfWidth; int posY = loc.getY() + halfHeight; Point point = new Point(posX, posY); return point; }
From source file:org.openecomp.sdc.ci.tests.datatypes.CanvasManager.java
License:Open Source License
private CanvasManager() { canvasElements = new HashMap<>(); actions = new Actions(GeneralUIUtils.getDriver()); // canvas = GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.CANVAS.getValue()); canvas = GeneralUIUtils.waitForClassNameVisibility("w-sdc-designer-canvas"); try {//from w ww.ja va 2 s . co m WebElement webElement = GeneralUIUtils .getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.CANVAS_RIGHT_PANEL.getValue()); reduceCanvasWidthFactor = webElement.getSize().width; } catch (Exception e) { reduceCanvasWidthFactor = 0; } }
From source file:org.openecomp.sdc.ci.tests.execute.resourceui.VFCanvasTest.java
License:Open Source License
public List<Integer> getposition(WebElement canvas, int width, int height) { width = canvas.getSize().getWidth(); height = canvas.getSize().getHeight(); Random r = new Random(); int Resultx = r.nextInt(width); int Resulty = r.nextInt(height); List<Integer> position = new ArrayList<Integer>(); position.add(Resultx);//from w w w. j a v a 2 s . co m position.add(Resulty); return position; }
From source file:org.openecomp.sdc.ci.tests.utilities.CanvasManager.java
License:Open Source License
private CanvasManager() { canvasElements = new HashMap<>(); actions = new Actions(GeneralUIUtils.getDriver()); canvas = GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.CANVAS.getValue()); try {/* www . j av a2s.c o m*/ WebElement webElement = GeneralUIUtils .getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.CANVAS_RIGHT_PANEL.getValue()); reduceCanvasWidthFactor = webElement.getSize().width; } catch (Exception e) { reduceCanvasWidthFactor = 0; } }
From source file:org.paxml.selenium.webdriver.PickSizeTag.java
License:Open Source License
/** * {@inheritDoc}/* w ww . ja v a 2 s . c o m*/ */ @Override protected Object onCommand(Context context) { return handleElements(new IElementHandler() { public Object handle(WebElement ele) { return ele.getSize(); } }); }
From source file:org.qe4j.web.OpenWebDriver.java
License:Open Source License
/** * Uses Selenium Actions to move the mouse over the center of the element * specified.//from w w w. jav a2 s.c o m * * @param by */ public void mouseOver(By by) { Actions actions = new Actions(webDriver); WebElement element = findElement(by); log.info("mouse over " + OpenWebElement.extractElementInfo(element)); Dimension dimension = element.getSize(); actions.moveToElement(element, dimension.width / 2, dimension.height / 2); actions.build().perform(); }
From source file:org.qe4j.web.OpenWebElement.java
License:Open Source License
/** * Performs a mouseover action relative to this element. * * @param by/*from ww w . j av a2 s . c om*/ */ public void mouseOver(By by) { Actions actions = new Actions(webDriver); WebElement element = webElement.findElement(by); Dimension dimension = element.getSize(); actions.moveToElement(element, dimension.width / 2, dimension.height / 2); actions.build().perform(); }
From source file:org.richfaces.fragment.common.Utils.java
License:Open Source License
/** * Returns Locations of input element./*ww w. ja v a 2 s . c o m*/ * * @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); }
From source file:org.richfaces.showcase.contextMenu.AbstractContextMenuTest.java
License:Open Source License
public double getTargetWidth(WebElement target) { Dimension dimension = target.getSize(); return dimension.getWidth(); }
From source file:org.richfaces.showcase.contextMenu.AbstractContextMenuTest.java
License:Open Source License
public double getTargetHeight(WebElement target) { Dimension dimension = target.getSize(); return dimension.getHeight(); }