当前位置: 首页>>代码示例>>Java>>正文


Java Rectangle类代码示例

本文整理汇总了Java中org.openqa.selenium.Rectangle的典型用法代码示例。如果您正苦于以下问题:Java Rectangle类的具体用法?Java Rectangle怎么用?Java Rectangle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Rectangle类属于org.openqa.selenium包,在下文中一共展示了Rectangle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: waitUntilAnimationFinished

import org.openqa.selenium.Rectangle; //导入依赖的package包/类
default void waitUntilAnimationFinished()
{
    SeleniumUtils.keepTrying(SeleniumGlobals.getLongTimeoutInSeconds(), () -> {
        WebElement element = element();

        if (element.isDisplayed())
        {
            return false;
        }

        Rectangle bounds = element.getRect();

        SeleniumUtils.waitForSeconds(0.1);

        return Objects.equals(element.getRect(), bounds) ? true : null;
    });
}
 
开发者ID:porscheinformatik,项目名称:selenium-components,代码行数:18,代码来源:AnimatedSeleniumComponent.java

示例2: getRect

import org.openqa.selenium.Rectangle; //导入依赖的package包/类
@Override
public Rectangle getRect()
{
    Rectangle returnValue = null;
    webDriver.getExecutionContext().startStep( createStep( "AT" ), null, null );
    try
    {
        returnValue = baseElement.getRect();
    }
    catch( Exception e )
    {
        webDriver.getExecutionContext().completeStep( StepStatus.FAILURE, e );
    }
    
    webDriver.getExecutionContext().completeStep( StepStatus.SUCCESS, null );
    
    return returnValue;
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:19,代码来源:ReportingWebElementAdapter.java

示例3: findElements

import org.openqa.selenium.Rectangle; //导入依赖的package包/类
@Override
public List<WebElement> findElements( SearchContext context )
{
    if ( imageName != null )
    {
        Rectangle r = webDriver.getCloud().getCloudActionProvider().findImage( webDriver, imageName, propertyMap );
        if ( r != null )
        {
            List<WebElement> elementList = new ArrayList<WebElement>( 1 );
            elementList.add( new VisualWebElement( webDriver, r ) );
            return elementList;
        }
    }
    
    return null;
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:17,代码来源:ByImage.java

示例4: findElements

import org.openqa.selenium.Rectangle; //导入依赖的package包/类
@Override
public List<WebElement> findElements( SearchContext context )
{
    if ( text != null )
    {
        Rectangle r = webDriver.getCloud().getCloudActionProvider().findText( webDriver, text, propertyMap );
        if ( r != null )
        {
            List<WebElement> elementList = new ArrayList<WebElement>( 1 );
            elementList.add( new VisualWebElement( webDriver, r ) );
            return elementList;
        }
    }
    
    return null;
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:17,代码来源:ByOCR.java

示例5: getElementsByCoordinates

import org.openqa.selenium.Rectangle; //导入依赖的package包/类
@Override
public ExtendedWebElement getElementsByCoordinates(int x, int y) {
    String elementName = String.format("Element founded by x:%d - y:%d", x, y);
    WebDriver driver = DriverPool.getDriver();
    List<WebElement> elements = getEndLevelElements(driver);
    List<WebElement> result = new ArrayList<WebElement>();
    Rectangle rect;
    for (WebElement webElement : elements) {
        try {
            rect = getRect(webElement);
        } catch (Exception e) {
            continue;
        }
        if (isInside(rect, x, y)) {
            result.add(webElement);
        }
    }
    return generateExtenedElement(result, driver, elementName);
}
 
开发者ID:qaprosoft,项目名称:carina,代码行数:20,代码来源:ScreenElementExtractor.java

示例6: findImage

import org.openqa.selenium.Rectangle; //导入依赖的package包/类
@Override
public Rectangle findImage( DeviceWebDriver webDriver, String imageName, Map<String, String> propertyMap )
{
    
    ImageExecution imageExec = PerfectoMobile.instance( webDriver.getxFID() ).imaging().imageExists( webDriver.getExecutionId(), webDriver.getDeviceName(), imageName, propertyMap );
    
    if ( imageExec != null && Boolean.parseBoolean( imageExec.getStatus() ) )
        return new Rectangle( new Point( Integer.parseInt( imageExec.getLeft() ), Integer.parseInt( imageExec.getTop() ) ), new Dimension( Integer.parseInt( imageExec.getWidth() ), Integer.parseInt( imageExec.getHeight() ) ) );
    
    return null;
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:12,代码来源:PERFECTOCloudActionProvider.java

示例7: findText

import org.openqa.selenium.Rectangle; //导入依赖的package包/类
@Override
public Rectangle findText( DeviceWebDriver webDriver, String text, Map<String, String> propertyMap )
{
    ImageExecution imageExec = PerfectoMobile.instance( webDriver.getxFID() ).imaging().textExists( webDriver.getExecutionId(), webDriver.getDeviceName(), text, propertyMap );
    
    
    if ( imageExec != null && Boolean.parseBoolean( imageExec.getStatus() ) )
           return new Rectangle( new Point( Integer.parseInt( imageExec.getLeft() ), Integer.parseInt( imageExec.getTop() ) ), new Dimension( Integer.parseInt( imageExec.getWidth() ), Integer.parseInt( imageExec.getHeight() ) ) );
    
    return null;
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:12,代码来源:PERFECTOCloudActionProvider.java

示例8: VisualWebElement

import org.openqa.selenium.Rectangle; //导入依赖的package包/类
public VisualWebElement ( DeviceWebDriver webDriver, Rectangle r )
{
    this.location = r.getPoint();
    this.size = r.getDimension();
    this.webDriver = webDriver;

}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:8,代码来源:VisualWebElement.java

示例9: getRect

import org.openqa.selenium.Rectangle; //导入依赖的package包/类
@Override
public Rectangle getRect() {
    if (rectCache == null) {
        rectCache = new ObjectCache<>(super::getRect);
    }
    return rectCache.getValue();
}
 
开发者ID:fhoeben,项目名称:hsac-fitnesse-fixtures,代码行数:8,代码来源:CachingRemoteWebElement.java

示例10: shouldCallGetRectOnUnderlyingWebElement

import org.openqa.selenium.Rectangle; //导入依赖的package包/类
@Test
public void shouldCallGetRectOnUnderlyingWebElement() {
    WebDriver.TargetLocator locator = mock(WebDriver.TargetLocator.class);
    WebDriverTarget target = mock(WebDriverTarget.class);
    TargetedWebElement element = mock(TargetedWebElement.class);
    when(element.getRect()).thenReturn(mock(Rectangle.class));
    TargetedWebElement targetedWebElement = new TargetedWebElement(locator, target, element);

    targetedWebElement.getRect();
    verify(element).getRect();
}
 
开发者ID:darcy-framework,项目名称:darcy-webdriver,代码行数:12,代码来源:TargetedWebElementTest.java

示例11: highlight

import org.openqa.selenium.Rectangle; //导入依赖的package包/类
@Override
public ICapturable highlight(Rectangle rect)
{
	try
	{
		Graphics2D g2d = screenshot.createGraphics();
		g2d.setColor(Color.red);
		g2d.drawRect(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
	}
	catch (Exception e) 
	{
		LOGGER.error("Unable to highligh screenshot: " + e.getMessage());
	}
	return this;
}
 
开发者ID:qaprosoft,项目名称:carina,代码行数:16,代码来源:Screen.java

示例12: isLower

import org.openqa.selenium.Rectangle; //导入依赖的package包/类
/**
 * Method return 1 in case if y is lower than element, -1 if higher, 0 - if
 * 'y' within the element's range
 * 
 * @param rect Rectangle
 * @param y int
 * @return int
 */
public int isLower(Rectangle rect, int y) {
    LOGGER.debug(String.format("isLower(): Rectangle: x - %d. y - %d. Width: %d, height: %d", rect.x, rect.y, rect.width, rect.height));
    if (y > rect.y + rect.height) {
        return 1;
    } else if (y < rect.y) {
        return -1;
    }
    return 0;
}
 
开发者ID:qaprosoft,项目名称:carina,代码行数:18,代码来源:AbstractElementExtractor.java

示例13: getElementsByCoordinates

import org.openqa.selenium.Rectangle; //导入依赖的package包/类
@Override
public ExtendedWebElement getElementsByCoordinates(int x, int y) {
    String elementName = String.format("Element founded by x:%d - y:%d", x, y);
    WebDriver driver = DriverPool.getDriver();
    List<WebElement> elements = getEndLevelElements(driver);
    WebElement tempElement;
    int index = 0;
    int isLower;
    Rectangle tempRect;
    while (elements.size() != 1) {
        index = (int) (Math.round(elements.size() / 2));
        tempElement = elements.get(index);
        tempRect = getRect(tempElement);
        isLower = isLower(tempRect, y);
        LOGGER.debug("Is Lower: " + isLower);
        if (isInside(tempRect, x, y) || isLower == 0) {
            break;
        }
        if (isLower == 1) {
            elements = elements.subList(index, elements.size());
        } else {
            elements = elements.subList(0, index);
        }
    }
    LOGGER.debug("Index: " + index);

    if (elements.size() == 1) {
        return generateExtenedElement(elements, driver, elementName);
    }

    return generateExtenedElement(checkBoundaryElements(elements, x, y, index), driver, elementName);
}
 
开发者ID:qaprosoft,项目名称:carina,代码行数:33,代码来源:DivisionElementExtractor.java

示例14: checkBoundaryElements

import org.openqa.selenium.Rectangle; //导入依赖的package包/类
/**
 * Method to check boundary elements since there is a chance that there are
 * some elements in the same 'y' range
 * 
 * @param elements
 * @param x
 * @param y
 * @param index
 * @return
 */
private List<WebElement> checkBoundaryElements(List<WebElement> elements, int x, int y, int index) {
    LOGGER.debug(String.format("Index: %d.", index));
    List<WebElement> elementsFirstPart = elements.subList(0, index);
    List<WebElement> elementsSecondPart = elements.subList(index, elements.size());
    List<WebElement> elementsInside = new ArrayList<WebElement>();
    WebElement element;
    Rectangle tempRect;
    for (int i = elementsFirstPart.size() - 1; i >= 0; i--) {
        element = elementsFirstPart.get(i);
        tempRect = getRect(element);
        if (isInside(tempRect, x, y)) {
            elementsInside.add(element);
        } else if (tempRect.y > y) {
            // stop validation as soon as 'y' coordinate will be out of
            // element's location
            break;
        }
    }

    for (int i = 0; i < elementsSecondPart.size(); i++) {
        element = elementsSecondPart.get(i);
        tempRect = getRect(element);

        if (isInside(tempRect, x, y)) {
            elementsInside.add(element);
        } else if (tempRect.y + tempRect.height < y) {
            // stop validation as soon as 'y' coordinate will be out of
            // element's location
            break;
        }
    }
    return elementsInside;
}
 
开发者ID:qaprosoft,项目名称:carina,代码行数:44,代码来源:DivisionElementExtractor.java

示例15: getRect

import org.openqa.selenium.Rectangle; //导入依赖的package包/类
@Override
public Rectangle getRect() {
	ensureReferenceNotStaled();
	return this.mElement.getRect();
}
 
开发者ID:ZabuzaW,项目名称:BrainBridge,代码行数:6,代码来源:StaleRefresherWebElement.java


注:本文中的org.openqa.selenium.Rectangle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。