當前位置: 首頁>>代碼示例>>Java>>正文


Java Point.getY方法代碼示例

本文整理匯總了Java中org.openqa.selenium.Point.getY方法的典型用法代碼示例。如果您正苦於以下問題:Java Point.getY方法的具體用法?Java Point.getY怎麽用?Java Point.getY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openqa.selenium.Point的用法示例。


在下文中一共展示了Point.getY方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import org.openqa.selenium.Point; //導入方法依賴的package包/類
@Override
public void run() {
    super.run();
    
    By locator = readLocatorArgument("locator");

    MobileElement element = getElement(locator);
    Point point = element.getLocation();

    int x = point.getX();
    int y = point.getY();

    int width = element.getSize().width;
    int height = element.getSize().height;
    
    Logger.trace(String.format("The element aspect is (%s,%s,%s,%s)",
            x, y, width, height));

    this.writeOutput("x", x);
    this.writeOutput("y", y);
    this.writeOutput("width", width);
    this.writeOutput("height", height);
}
 
開發者ID:mcdcorp,項目名稱:opentest,代碼行數:24,代碼來源:ReadElementAspect.java

示例2: swipeDown

import org.openqa.selenium.Point; //導入方法依賴的package包/類
protected void swipeDown(MobileElement element) {
        Point point = element.getLocation();
        Dimension size = driver.manage().window().getSize();

        int screenHeight = (int) (size.height * 0.90);
        int elementY = point.getY();

        int endX = 0;
        int endY = ((int) screenHeight - elementY);
//        Logger.debug("Device height:" + size.getHeight() + "$$$ Device width:" + size.getWidth());
//        Logger.debug("Element X:" + point.getX() + "$$$ Element Y:" + point.getY());
//        Logger.debug("Element Height:" + element.getSize().height + "$$$$ Element Width:" + element.getSize().width);
//        Logger.debug("end X:" + endX + "$$$$end Y:" + endY);
        TouchAction action = new TouchAction((MobileDriver) driver);
        //action.press(element).moveTo(endX, endY).release().perform();
        action.press(element.getCenter().getX(), element.getCenter().getY()).moveTo(endX, screenHeight - element.getCenter().getY()).release().perform();

    }
 
開發者ID:mcdcorp,項目名稱:opentest,代碼行數:19,代碼來源:AppiumTestAction.java

示例3: returnElementPosition

import org.openqa.selenium.Point; //導入方法依賴的package包/類
protected void returnElementPosition(MobileElement element) {

        Point point;
        MobileElement element1;

        List<MobileElement> allElements = (List<MobileElement>) element.findElements(By.xpath(".//*"));

        for (int i = 0; i < allElements.size(); i++) {
            element1 = allElements.get(i);
            point = element1.getLocation();

            int x = point.getX();
            int y = point.getY();

            int width = element.getSize().width;
            int height = element.getSize().height;
            break;
        }
    }
 
開發者ID:mcdcorp,項目名稱:opentest,代碼行數:20,代碼來源:AppiumTestAction.java

示例4: expectLocation

import org.openqa.selenium.Point; //導入方法依賴的package包/類
/**
 * Check Element Position
 * @param xpath
 * @param X
 * @param Y
 */
public void expectLocation(String xpath, int X, int Y){
	if(elementExist(xpath)){
		Point point = be.getElementPosition(xpath);
		if(point.getX()==X && point.getY()==Y){
			logger.info("***** Position Right!\n");
			HtmlLogUtil.appendLog2Html(htmlLogFile, 1, "元素位置檢驗正確 : ["+xpath+"]");
		}
		else{
			logger.info("***** Position Error!\n");
			HtmlLogUtil.appendLog2Html(htmlLogFile, 0, "元素位置檢驗錯誤 : ["+xpath+"] X="+point.getX()+"  Y="+point.getY());
		}
		
	}
	else
		elementOut();
}
 
開發者ID:IssacCzy,項目名稱:EarthWorm,代碼行數:23,代碼來源:BrowserAction.java

示例5: pinch

import org.openqa.selenium.Point; //導入方法依賴的package包/類
/**
 * Convenience method for pinching an element on the screen.
 * "pinching" refers to the action of two appendages pressing the
 * screen and sliding towards each other.
 * NOTE:
 * This convenience method places the initial touches around the element, if this would
 * happen to place one of them off the screen, appium with return an outOfBounds error.
 * In this case, revert to using the MultiTouchAction api instead of this method.
 *
 * @param el The element to pinch.
 */
public void pinch(WebElement el) {
    MultiTouchAction multiTouch = new MultiTouchAction(this);

    Dimension dimensions = el.getSize();
    Point upperLeft = el.getLocation();
    Point center = new Point(upperLeft.getX() + dimensions.getWidth() / 2,
        upperLeft.getY() + dimensions.getHeight() / 2);
    int yOffset = center.getY() - upperLeft.getY();

    TouchAction action0 =
        new TouchAction(this).press(el, center.getX(), center.getY() - yOffset).moveTo(el)
            .release();
    TouchAction action1 =
        new TouchAction(this).press(el, center.getX(), center.getY() + yOffset).moveTo(el)
            .release();

    multiTouch.add(action0).add(action1);

    multiTouch.perform();
}
 
開發者ID:JoeUtt,項目名稱:menggeqa,代碼行數:32,代碼來源:AppiumDriver.java

示例6: zoom

import org.openqa.selenium.Point; //導入方法依賴的package包/類
/**
 * Convenience method for "zooming in" on an element on the screen.
 * "zooming in" refers to the action of two appendages pressing the screen and sliding
 * away from each other.
 * NOTE:
 * This convenience method slides touches away from the element, if this would happen
 * to place one of them off the screen, appium will return an outOfBounds error.
 * In this case, revert to using the MultiTouchAction api instead of this method.
 *
 * @param el The element to pinch.
 */
public void zoom(WebElement el) {
    MultiTouchAction multiTouch = new MultiTouchAction(this);

    Dimension dimensions = el.getSize();
    Point upperLeft = el.getLocation();
    Point center = new Point(upperLeft.getX() + dimensions.getWidth() / 2,
        upperLeft.getY() + dimensions.getHeight() / 2);
    int yOffset = center.getY() - upperLeft.getY();

    TouchAction action0 = new TouchAction(this).press(center.getX(), center.getY())
        .moveTo(el, center.getX(), center.getY() - yOffset).release();
    TouchAction action1 = new TouchAction(this).press(center.getX(), center.getY())
        .moveTo(el, center.getX(), center.getY() + yOffset).release();

    multiTouch.add(action0).add(action1);

    multiTouch.perform();
}
 
開發者ID:JoeUtt,項目名稱:menggeqa,代碼行數:30,代碼來源:AppiumDriver.java

示例7: setFirstPickerWheelValue

import org.openqa.selenium.Point; //導入方法依賴的package包/類
@Step
@When("установить пикер в первое значение")
public void setFirstPickerWheelValue() {
    WebElement webElement = driver.findElement(By.xpath(pickerWheelXPath));
    Point center = ((IOSElement) webElement).getCenter();
    Dimension size = webElement.getSize();
    int height = size.getHeight();
    Point target = new Point(center.getX(), center.getY() - (int) (height * stepToLast));
    TouchAction touchAction = new TouchAction(driver);
    touchAction.press(target.getX(), target.getY()).release();
    touchAction.perform();
}
 
開發者ID:alfa-laboratory,項目名稱:colibri-ui,代碼行數:13,代碼來源:BaseIOSPickerWheelSteps.java

示例8: setLastPickerWheelValue

import org.openqa.selenium.Point; //導入方法依賴的package包/類
@Step
@When("установить пикер в последнее значение")
public void setLastPickerWheelValue() {
    WebElement webElement = driver.findElement(By.xpath(pickerWheelXPath));
    Point center = ((IOSElement) webElement).getCenter();
    Dimension size = webElement.getSize();
    int height = size.getHeight();
    Point target = new Point(center.getX(), center.getY() + (int) (height * stepToLast));
    TouchAction touchAction = new TouchAction(driver);
    touchAction.press(target.getX(), target.getY()).release();
    touchAction.perform();
}
 
開發者ID:alfa-laboratory,項目名稱:colibri-ui,代碼行數:13,代碼來源:BaseIOSPickerWheelSteps.java

示例9: hover

import org.openqa.selenium.Point; //導入方法依賴的package包/類
@Override
public void hover(Element ele)
{
	WebElement webEle = searchStrategyUtils.findStrategy(WebElement.class, ele).search(ele);
	if(webEle == null)
	{
		logger.warn("can not found element.");
		return;
	}
	
	if(!(ele instanceof FileUpload))
	{
		Dimension size = webEle.getSize();
		Point loc = webEle.getLocation();
		int toolbarHeight = engine.getToolbarHeight();
		int x = size.getWidth() / 2 + loc.getX();
		int y = size.getHeight() / 2 + loc.getY() + toolbarHeight;
		
		try
		{
			new Robot().mouseMove(x, y);
		}
		catch (AWTException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
 
開發者ID:LinuxSuRen,項目名稱:phoenix.webui.framework,代碼行數:30,代碼來源:SeleniumHover.java

示例10: CyclicQuad

import org.openqa.selenium.Point; //導入方法依賴的package包/類
public CyclicQuad(Point location, int height, int width){

        int x = location.getX();
        int y = location.getY();

        //Set the selenium points
        this.Point_A = new Point(x,y);
        this.Point_B = new Point(x + width, y );
        this.Point_C = new Point(x + width, y + height);
        this.Point_D = new Point(x , y + height);

        //Set the polygon
        this.rectangle = new Rectangle(x,y,width,height);
    }
 
開發者ID:sethijatin,項目名稱:creative-element,代碼行數:15,代碼來源:CyclicQuad.java

示例11: getActualPoint

import org.openqa.selenium.Point; //導入方法依賴的package包/類
/**
 * Gets the actual point.
 *
 * @param percentagePoint the percentage point
 * @param screenDimension the screen dimension
 * @return the actual point
 */
protected Point getActualPoint( Point percentagePoint, Dimension screenDimension )
{
	if ( webElement != null )
	{
		if ( webElement.getLocation() != null && webElement.getSize() != null && webElement.getSize().getWidth() > 0 && webElement.getSize().getHeight() > 0 )
		{
			int x = percentagePoint.getX() * webElement.getSize().getWidth() + webElement.getLocation().getX();
			int y = percentagePoint.getY() * webElement.getSize().getHeight() + webElement.getLocation().getY();
			return new Point( x, y );
		}
	}
	
	return new Point( (int) ( (percentagePoint.getX() / 100.0 ) * (double)screenDimension.getWidth() ), (int) ( (percentagePoint.getY() / 100.0 ) * (double)screenDimension.getHeight() ) );
}
 
開發者ID:xframium,項目名稱:xframium-java,代碼行數:22,代碼來源:AbstractGesture.java

示例12: getCenter

import org.openqa.selenium.Point; //導入方法依賴的package包/類
/**
 * Method returns central coordinates of an element.
 * @return The instance of the {@link org.openqa.selenium.Point}
 */
public Point getCenter() {
    Point upperLeft = this.getLocation();
    Dimension dimensions = this.getSize();
    return new Point(upperLeft.getX() + dimensions.getWidth() / 2,
        upperLeft.getY() + dimensions.getHeight() / 2);
}
 
開發者ID:JoeUtt,項目名稱:menggeqa,代碼行數:11,代碼來源:MobileElement.java

示例13: elementScreenshot

import org.openqa.selenium.Point; //導入方法依賴的package包/類
/**
 * Returns an element's screenshot.
 */
public BufferedImage elementScreenshot(WebElement lay) {
	Point location = lay.getLocation();
	Dimension size = lay.getSize();

	//-- Check dimensions to prevent looking outside the window
	int sx = location.x;
	int sy = location.y;
	int width = size.width;
	int height = size.height;
	int ex = location.getX() + width;
	int ey = location.getY() + height;
	if(ey > 0 && ex > 0) {
		if(sx < m_image.getWidth() && sy < m_image.getHeight()) {
			boolean truncated = false;
			if(sx + width > m_image.getWidth()) {
				width = m_image.getWidth() - sx;
				truncated = true;
			}
			if(sy + height > m_image.getHeight()) {
				height = m_image.getHeight() - sy;
				truncated = true;
			}
			if(truncated) {
				Dimension screen = m_wd.getSize();
				System.err.println("WARNING: snapshot of " + lay + " has been truncated because part of it is off-screen (screen size is " + screen.width + "x" + screen.height + ")");
			}

			return m_image.getSubimage(location.getX(), location.getY(), width, height);
		}
	}

	throw new IllegalStateException("CANNOT TAKE SCREENSHOT: object(" + sx + "," + sy + " to " +ex + "," + ey + " is not within the screen boundaries (" + m_image.getWidth() +"x" + m_image.getHeight());
}
 
開發者ID:fjalvingh,項目名稱:domui,代碼行數:37,代碼來源:ScreenInspector.java

示例14: Coordinates

import org.openqa.selenium.Point; //導入方法依賴的package包/類
public Coordinates(WebElement element) {
    Point point = element.getLocation();
    Dimension size = element.getSize();
    this.width = size.getWidth();
    this.height = size.getHeight();
    this.x = point.getX();
    this.y = point.getY();
}
 
開發者ID:assertthat,項目名稱:selenium-shutterbug,代碼行數:9,代碼來源:Coordinates.java

示例15: bounceThatWindow

import org.openqa.selenium.Point; //導入方法依賴的package包/類
@Test
public void bounceThatWindow(){
    WebDriver driver = new FirefoxDriver();
    driver.get("file://" + System.getProperty("user.dir") + "/jsrunner.html");
    driver.manage().window().maximize();
    Dimension fullScreenSize = driver.manage().window().getSize();

    int changeWidth = 200; int changeHeight = 210;
    int xDir = 8; int yDir = 8; int xDirIncrement = xDir; int yDirIncrement = yDir;

    driver.manage().window().setSize(new Dimension(changeWidth,changeHeight));

    Point position = driver.manage().window().getPosition();

    String banner = "***BANG****........ AND THEY ARE OFF........ Automation can be fun. " +
            " EvilTester.com present a javascript and browser" +
            " animation using Selenium 2 WebDriver tribute to the" +
            " sporting event that cannot be named lest we be sued";
    int bannerStart = 0;

    for(int bounceIterations = 0; bounceIterations < 1000; bounceIterations ++){

        position = position.moveBy(xDir,yDir);
        driver.manage().window().setPosition(position);

        if(position.getX()>(fullScreenSize.getWidth() - changeWidth)){ xDir = -1 * xDirIncrement; }
        if(position.getX()<0){ xDir = xDirIncrement; }
        if(position.getY()>(fullScreenSize.getHeight() - changeHeight)){ yDir = -1 * yDirIncrement; }
        if(position.getY()<0){ yDir = yDirIncrement; }

        //try {Thread.sleep(20);} catch (InterruptedException e) {}
        String displayBanner = banner.substring(bannerStart,bannerStart+30);
        ((JavascriptExecutor)driver).executeScript("document.title='" + displayBanner + "';");
        bannerStart++;
        if(bannerStart > banner.length()-35){banner += banner;}
    }

    driver.quit();
}
 
開發者ID:eviltester,項目名稱:webDriverExperiments,代碼行數:40,代碼來源:SportsEventTributeTest.java


注:本文中的org.openqa.selenium.Point.getY方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。