use of org.openqa.selenium.Point in project ghostdriver by detro.
the class WindowSizingAndPositioningTest method manipulateWindowPosition.
@Test
public void manipulateWindowPosition() {
WebDriver d = getDriver();
d.get("http://www.google.com");
assertTrue(d.manage().window().getPosition().x >= 0);
assertTrue(d.manage().window().getPosition().y >= 0);
d.manage().window().setPosition(new Point(0, 0));
assertTrue(d.manage().window().getPosition().x == 0);
assertTrue(d.manage().window().getPosition().y == 0);
}
use of org.openqa.selenium.Point in project android by owncloud.
the class FileListView method pulldownToRefresh.
public void pulldownToRefresh() throws InterruptedException {
Point listLocation = listLayout.getLocation();
driver.swipe(listLocation.getX(), listLocation.getY(), listLocation.getX(), listLocation.getY() + 1000, 5000);
}
use of org.openqa.selenium.Point in project android by owncloud.
the class FileListView method pulldownToSeeNotification.
public void pulldownToSeeNotification() throws InterruptedException {
Point listLocation = deviceScreen.getLocation();
driver.swipe(listLocation.getX(), listLocation.getY(), listLocation.getX(), listLocation.getY() + 1000, 5000);
}
use of org.openqa.selenium.Point in project selenium-tests by Wikia.
the class Shooter method getBoundingClientRect.
private Object[] getBoundingClientRect(WebElement element, WebDriver driver) {
JavascriptExecutor js = (JavascriptExecutor) driver;
ArrayList<String> list = (ArrayList<String>) js.executeScript("var rect = arguments[0].getBoundingClientRect();" + "return [ '' + parseInt(rect.left), '' + parseInt(rect.top), '' + parseInt(rect.width), '' + parseInt(rect.height) ]", element);
Point start = new Point(Integer.parseInt(list.get(0)), Integer.parseInt(list.get(1)));
Dimension size = new Dimension(Integer.parseInt(list.get(2)), Integer.parseInt(list.get(3)));
return new Object[] { start, size };
}
use of org.openqa.selenium.Point in project selenium-tests by Wikia.
the class Shooter method captureWebElement.
/**
* Create a screenshot of passed element and save screenshot as image file in temp dir. <p> Notes:
* Method works properly in Google Chrome only if devicePixelRatio equals 1. </p>
*
* @param element - WebElement you want to capture
* @param driver - instance of WebDriver
* @return File path - file's handler which was saved in given path
*/
public File captureWebElement(WebElement element, WebDriver driver) {
Point start = element.getLocation();
Dimension size = element.getSize();
if (!"FF".equals(Configuration.getBrowser())) {
Object[] rect = getBoundingClientRect(element, driver);
start = (Point) rect[0];
size = (Dimension) rect[1];
}
File image = imageEditor.cropImage(start, size, capturePage(driver));
PageObjectLogging.logImage("Shooter", image, true);
return image;
}
Aggregations