List of usage examples for org.openqa.selenium Rectangle Rectangle
public Rectangle(Point p, Dimension d)
From source file:com.seleniumtests.uipage.htmlelements.CachedHtmlElement.java
License:Apache License
public CachedHtmlElement(Element jsoupElement) { location = new Point(0, 0); size = new Dimension(0, 0); rectangle = new Rectangle(location, size); selected = false;/*from ww w.ja v a 2 s . com*/ cachedElement = jsoupElement; realElement = null; }
From source file:com.seleniumtests.uipage.htmlelements.CachedHtmlElement.java
License:Apache License
public CachedHtmlElement(WebElement elementToCache) { try {/* w w w .j a va2 s .co m*/ rectangle = elementToCache.getRect(); location = new Point(rectangle.x, rectangle.y); size = new Dimension(rectangle.width, rectangle.height); } catch (WebDriverException e) { location = elementToCache.getLocation(); size = elementToCache.getSize(); rectangle = new Rectangle(location, size); } cachedElement = Jsoup.parseBodyFragment(elementToCache.getAttribute("outerHTML")).body().child(0); if ("option".equals(cachedElement.tagName()) || ("input".equals(cachedElement.tagName()) && "checkbox".equals(cachedElement.attributes().getIgnoreCase("type"))) || ("input".equals(cachedElement.tagName()) && "radio".equals(cachedElement.attributes().getIgnoreCase("type")))) { selected = elementToCache.isSelected(); } else { selected = false; } realElement = elementToCache; }
From source file:com.seleniumtests.uipage.htmlelements.HtmlElement.java
License:Apache License
@Override @ReplayOnError public Rectangle getRect() { findElement(false, false); return new Rectangle(element.getLocation(), element.getSize()); }
From source file:com.seleniumtests.ut.uipage.TestCachedHtmlElement.java
License:Apache License
@Test(groups = { "ut" }) public void testGetRectangle() { // depends on where we execute the test, rectangle may throw an exception Rectangle rect;//from w w w .j a v a 2s . c o m try { rect = DriverTestPage.selectList.getElement().getRect(); } catch (WebDriverException e) { rect = new Rectangle(DriverTestPage.selectList.getElement().getLocation(), DriverTestPage.selectList.getElement().getSize()); } Assert.assertEquals(new CachedHtmlElement(DriverTestPage.selectList.getElement()).getRect(), rect); }
From source file:org.xframium.device.factory.CachedWebElement.java
License:Open Source License
public Rectangle getRect() { return new Rectangle(getLocation(), getSize()); }
From source file:org.zanata.util.TestEventForScreenshotListener.java
License:Open Source License
private Rectangle getScreenRectangle() { // http://stackoverflow.com/a/13380999/14379 Rectangle2D result = new Rectangle2D.Double(); GraphicsEnvironment localGE = GraphicsEnvironment.getLocalGraphicsEnvironment(); for (GraphicsDevice gd : localGE.getScreenDevices()) { for (GraphicsConfiguration graphicsConfiguration : gd.getConfigurations()) { Rectangle2D.union(result, graphicsConfiguration.getBounds(), result); }//from w w w. java 2 s . c o m } return new Rectangle((int) result.getWidth(), (int) result.getHeight()); }
From source file:ru.stqa.selenium.decorated.DecoratedWebElementTest.java
License:Apache License
@Test void testGetRect() { verifyFunction(WebElement::getRect, new Rectangle(new Point(10, 20), new Dimension(100, 200))); }