List of usage examples for org.openqa.selenium WebElement getLocation
Point getLocation();
From source file:org.uiautomation.ios.selenium.interactions.touch.TouchFlickTest.java
License:Apache License
@NeedsFreshDriver @Test//from w w w.j a v a 2 s.c o m public void testCanFlickHorizontallyFastFromWebElement() { driver.get(pages.longContentPage); WebElement toFlick = driver.findElement(By.id("imagestart")); WebElement link = driver.findElement(By.id("link2")); int originalX = link.getLocation().x; // The element is located at the right of the page, // so it is not initially visible on the screen. Action flick = getBuilder(driver).flick(toFlick, -1000, 0, FlickAction.SPEED_FAST).build(); flick.perform(); int newX = link.getLocation().x; // After flicking, the element should now be visible on the screen. assertTrue("Expected x < " + originalX + ", but got x = " + newX, newX < originalX); }
From source file:org.uiautomation.ios.selenium.interactions.touch.TouchFlickTest.java
License:Apache License
@NeedsFreshDriver @Test/*w ww . j a va 2s. co m*/ public void testCanFlickHorizontally() { driver.get(pages.clicksPage); driver.get(pages.longContentPage); WebElement link = driver.findElement(By.id("link1")); int originalX = link.getLocation().x; // The element is located at the right of the page, // so it is not initially visible on the screen. Action flick = getBuilder(driver).flick(-1000, 0).build(); flick.perform(); int newX = link.getLocation().x; // After flicking, the element should now be visible on the screen. assertTrue("Expected x < " + originalX + ", but got x = " + newX, newX < originalX); }
From source file:org.uiautomation.ios.selenium.interactions.touch.TouchFlickTest.java
License:Apache License
@NeedsFreshDriver @Test//from ww w . j av a 2s . co m public void testCanFlickHorizontallyFast() { driver.get(pages.longContentPage); WebElement link = driver.findElement(By.id("link2")); int originalX = link.getLocation().x; // The element is located at the right of the page, // so it is not initially visible on the screen. Action flick = getBuilder(driver).flick(-1500, 0).build(); flick.perform(); int newX = link.getLocation().x; // After flicking, the element should now be visible on the screen. assertTrue("Expected x < " + originalX + ", but got x = " + newX, newX < originalX); }
From source file:org.uiautomation.ios.selenium.interactions.touch.TouchFlickTest.java
License:Apache License
@NeedsFreshDriver @Test/*from ww w.j a v a 2 s.c o m*/ public void testCanFlickVerticallyFromWebElement() { driver.get(pages.longContentPage); WebElement link = driver.findElement(By.id("link3")); int originalY = link.getLocation().y; // The element is located at the bottom of the page, // so it is not initially visible on the screen. WebElement toFlick = driver.findElement(By.id("imagestart")); Action flick = getBuilder(driver).flick(toFlick, 0, -600, FlickAction.SPEED_NORMAL).build(); flick.perform(); int newY = link.getLocation().y; // After flicking, the element should now be visible on the screen. assertTrue("Expected y < " + originalY + ", but got y = " + newY, newY < originalY); }
From source file:org.uiautomation.ios.selenium.interactions.touch.TouchFlickTest.java
License:Apache License
@NeedsFreshDriver @Test//from ww w. j a v a 2 s . c o m public void testCanFlickVerticallyFastFromWebElement() { driver.get(pages.longContentPage); WebElement link = driver.findElement(By.id("link4")); int originalY = link.getLocation().y; // The element is located at the bottom of the page, // so it is not initially visible on the screen. WebElement toFlick = driver.findElement(By.id("imagestart")); Action flick = getBuilder(driver).flick(toFlick, 0, -600, FlickAction.SPEED_FAST).build(); flick.perform(); int newY = link.getLocation().y; // After flicking, the element should now be visible on the screen. assertTrue("Expected y < " + originalY + ", but got y = " + newY, newY < originalY); }
From source file:org.uiautomation.ios.selenium.interactions.touch.TouchFlickTest.java
License:Apache License
@NeedsFreshDriver @Test// w w w .j a v a2 s. c om public void testCanFlickVertically() { driver.get(pages.longContentPage); WebElement link = driver.findElement(By.id("link3")); int originalY = link.getLocation().y; // The element is located at the bottom of the page, // so it is not initially visible on the screen. Action flick = getBuilder(driver).flick(0, -1500).build(); flick.perform(); int newY = link.getLocation().y; // After flicking, the element should now be visible on the screen. assertTrue("Expected y < " + originalY + ", but got y = " + newY, newY < originalY); }
From source file:org.uiautomation.ios.selenium.interactions.touch.TouchFlickTest.java
License:Apache License
@NeedsFreshDriver @Test//from www .j a va 2s . co m public void testCanFlickVerticallyFast() { driver.get(pages.longContentPage); WebElement link = driver.findElement(By.id("link4")); int originalY = link.getLocation().y; // The element is located at the bottom of the page, // so it is not initially visible on the screen. Action flick = getBuilder(driver).flick(0, -1500).build(); flick.perform(); int newY = link.getLocation().y; // After flicking, the element should now be visible on the screen. assertTrue("Expected y < " + originalY + ", but got y = " + newY, newY < originalY); }
From source file:org.uiautomation.ios.selenium.interactions.touch.TouchScrollTest.java
License:Apache License
@NeedsFreshDriver @Test//w ww . j av a2 s . com public void testCanScrollVerticallyFromWebElement() { driver.get(pages.longContentPage); WebElement link = driver.findElement(By.id("link3")); int y = link.getLocation().y; // The element is located at the right of the page, // so it is not initially visible on the screen. assertTrue("Expected y > 4200, but got y = " + y, y > 4200); WebElement toScroll = driver.findElement(By.id("imagestart")); Action scroll = getBuilder(driver).scroll(toScroll, 0, -800).build(); scroll.perform(); y = link.getLocation().y; // After scrolling, the location of the element should change accordingly. assertTrue("Expected y < 3500, but got y = " + y, y < 3500); }
From source file:org.uiautomation.ios.selenium.interactions.touch.TouchScrollTest.java
License:Apache License
@NeedsFreshDriver @Test//from w w w. j a v a 2 s. co m public void testCanScrollHorizontallyFromWebElement() { driver.get(pages.longContentPage); WebElement link = driver.findElement(By.id("link1")); int x = link.getLocation().x; // The element is located at the right of the page, // so it is not initially visible on the screen. assertTrue("Expected x > 1500, but got x = " + x, x > 1500); WebElement toScroll = driver.findElement(By.id("imagestart")); Action scroll = getBuilder(driver).scroll(toScroll, -100, 0).build(); scroll.perform(); x = link.getLocation().x; // After scrolling, the location of the element should change accordingly. assertTrue("Expected x < 1500, but got x = " + x, x < 1500); }
From source file:org.uiautomation.ios.selenium.interactions.touch.TouchScrollTest.java
License:Apache License
@NeedsFreshDriver @Test//from www .ja v a 2 s. c o m public void testCanScrollVertically() { driver.get(pages.longContentPage); WebElement link = driver.findElement(By.id("link3")); int y = link.getLocation().y; // The element is located at the right of the page, // so it is not initially visible on the screen. assertTrue(y > 1200); Action scrollDown = getBuilder(driver).scroll(0, 800).build(); scrollDown.perform(); y = link.getLocation().y; // After scrolling, the location of the element should change accordingly. assertTrue(y < 3500); }