• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java HasTouchScreen类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getTouch

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
@Override
public TouchScreen getTouch()
{
    setLastAction();
    if ( webDriver instanceof HasTouchScreen )
        return ((HasTouchScreen) webDriver).getTouch();
    else
        return null;
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:10,代码来源:DeviceWebDriver.java


示例2: _moveTo

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
public boolean _moveTo()
{
    WebElement webElement = getElement();
    if ( webElement != null && webElement.getSize().getHeight() > 0 && webElement.getSize().getWidth() > 0 )
    {
        if ( getWebDriver() instanceof HasInputDevices )
        {
            if ( isTimed() )
                getActionProvider().startTimer( (DeviceWebDriver) getWebDriver(), this, getExecutionContext() );

            if ( ((DeviceWebDriver) getWebDriver()).getNativeDriver() instanceof AppiumDriver )
            {
                new TouchAction( (AppiumDriver) ((DeviceWebDriver) getWebDriver()).getNativeDriver() ).moveTo( webElement ).perform();
            }
            else if ( ((DeviceWebDriver) getWebDriver()).getNativeDriver() instanceof RemoteWebDriver )
            {
                if ( ((DeviceWebDriver) getWebDriver()).getNativeDriver() instanceof HasTouchScreen )
                    new TouchActions( getWebDriver() ).moveToElement( webElement ).build().perform();
                else
                    new Actions( getWebDriver() ).moveToElement( webElement ).build().perform();
            }

            return true;
        }
    }

    return false;
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:29,代码来源:SeleniumElement.java


示例3: _press

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
public boolean _press()
{
    WebElement webElement = getElement();
    if ( webElement != null && webElement.getSize().getHeight() > 0 && webElement.getSize().getWidth() > 0 )
    {
        if ( getWebDriver() instanceof HasInputDevices )
        {
            if ( isTimed() )
                getActionProvider().startTimer( (DeviceWebDriver) getWebDriver(), this, getExecutionContext() );

            if ( ((DeviceWebDriver) getWebDriver()).getNativeDriver() instanceof AppiumDriver )
            {
                new TouchAction( (AppiumDriver) ((DeviceWebDriver) getWebDriver()).getNativeDriver() ).press( webElement ).perform();
            }
            else if ( ((DeviceWebDriver) getWebDriver()).getNativeDriver() instanceof RemoteWebDriver )
            {
                if ( ((DeviceWebDriver) getWebDriver()).getNativeDriver() instanceof HasTouchScreen )
                    new TouchActions( getWebDriver() ).clickAndHold( webElement ).build().perform();
                else
                    new Actions( getWebDriver() ).clickAndHold( webElement ).build().perform();
            }

            return true;
        }
    }

    return false;
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:29,代码来源:SeleniumElement.java


示例4: _mouseDoubleClick

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
public boolean _mouseDoubleClick()
{
    WebElement webElement = getElement();
    if ( webElement != null && webElement.getSize().getHeight() > 0 && webElement.getSize().getWidth() > 0 )
    {
        if ( getWebDriver() instanceof HasInputDevices )
        {
            if ( isTimed() )
                getActionProvider().startTimer( (DeviceWebDriver) getWebDriver(), this, getExecutionContext() );

            if ( ((DeviceWebDriver) getWebDriver()).getNativeDriver() instanceof AppiumDriver )
            {
                new TouchAction( (AppiumDriver) ((DeviceWebDriver) getWebDriver()).getNativeDriver() ).tap( webElement ).tap( webElement ).perform();
            }
            else if ( ((DeviceWebDriver) getWebDriver()).getNativeDriver() instanceof RemoteWebDriver )
            {
                if ( ((DeviceWebDriver) getWebDriver()).getNativeDriver() instanceof HasTouchScreen )
                    new TouchActions( getWebDriver() ).doubleClick().build().perform();
                else
                    new Actions( getWebDriver() ).doubleClick( webElement ).build().perform();
            }

            return true;
        }
    }

    return false;
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:29,代码来源:SeleniumElement.java


示例5: _release

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
public boolean _release()
{
    WebElement webElement = getElement();
    if ( webElement != null && webElement.getSize().getHeight() > 0 && webElement.getSize().getWidth() > 0 )
    {
        if ( getWebDriver() instanceof HasInputDevices )
        {
            if ( isTimed() )
                getActionProvider().startTimer( (DeviceWebDriver) getWebDriver(), this, getExecutionContext() );

            if ( ((DeviceWebDriver) getWebDriver()).getNativeDriver() instanceof AppiumDriver )
            {
                new TouchAction( (AppiumDriver) ((DeviceWebDriver) getWebDriver()).getNativeDriver() ).release().perform();
            }
            else if ( ((DeviceWebDriver) getWebDriver()).getNativeDriver() instanceof RemoteWebDriver )
            {
                if ( ((DeviceWebDriver) getWebDriver()).getNativeDriver() instanceof HasTouchScreen )
                    new TouchActions( getWebDriver() ).release().build().perform();
                else
                    new Actions( getWebDriver() ).release().build().perform();
            }
            return true;
        }
    }

    return false;
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:28,代码来源:SeleniumElement.java


示例6: clickAt

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
private void clickAt( WebElement webElement, WebDriver webDriver, int x, int y )
{
    if ( webElement != null )
    {

        Dimension elementSize = webElement.getSize();

        int useX = (int) ((double) elementSize.getWidth() * ((double) x / 100.0));
        int useY = (int) ((double) elementSize.getHeight() * ((double) y / 100.0));


        if ( ((DeviceWebDriver) webDriver).getNativeDriver() instanceof AppiumDriver )
        {
            new TouchAction( (AppiumDriver) ((DeviceWebDriver) webDriver).getNativeDriver() ).moveTo( webElement ).tap( webElement, useX, useY ).perform();
        }
        else if ( ((DeviceWebDriver) webDriver).getNativeDriver() instanceof RemoteWebDriver )
        {
            if ( ((DeviceWebDriver) webDriver).getNativeDriver() instanceof HasTouchScreen )
                new TouchActions( webDriver ).moveToElement( webElement, useX, useY ).click().build().perform();
            else
                new Actions( webDriver ).moveToElement( webElement, useX, useY ).click().build().perform();
        }

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


示例7: call

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
@Override
public Void call() throws Exception {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();
  WebElement element = getKnownElements().get(elementId);
  Coordinates elementLocation = ((Locatable) element).getCoordinates();

  touchScreen.singleTap(elementLocation);

  return null;
}
 
开发者ID:alexkogon,项目名称:grid-refactor-remote-server,代码行数:11,代码来源:SingleTapOnElement.java


示例8: call

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
@Override
public Void call() throws Exception {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();

  touchScreen.down(x, y);

  return null;
}
 
开发者ID:alexkogon,项目名称:grid-refactor-remote-server,代码行数:9,代码来源:Down.java


示例9: call

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
@Override
public Void call() throws Exception {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();

  if (elementId != null) {
    WebElement element = getKnownElements().get(elementId);
    Coordinates elementLocation = ((Locatable) element).getCoordinates();
    touchScreen.flick(elementLocation, xOffset, yOffset, speed);
  } else {
    touchScreen.flick(xSpeed, ySpeed);
  }

  return null;
}
 
开发者ID:alexkogon,项目名称:grid-refactor-remote-server,代码行数:15,代码来源:Flick.java


示例10: call

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
@Override
public Void call() throws Exception {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();

  touchScreen.up(x, y);

  return null;
}
 
开发者ID:alexkogon,项目名称:grid-refactor-remote-server,代码行数:9,代码来源:Up.java


示例11: call

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
@Override
public Void call() throws Exception {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();
  WebElement element = getKnownElements().get(elementId);
  Coordinates elementLocation = ((Locatable) element).getCoordinates();

  touchScreen.doubleTap(elementLocation);

  return null;
}
 
开发者ID:alexkogon,项目名称:grid-refactor-remote-server,代码行数:11,代码来源:DoubleTapOnElement.java


示例12: call

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
@Override
public Void call() throws Exception {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();
  WebElement element = getKnownElements().get(elementId);
  Coordinates elementLocation = ((Locatable) element).getCoordinates();
  touchScreen.longPress(elementLocation);

  return null;
}
 
开发者ID:alexkogon,项目名称:grid-refactor-remote-server,代码行数:10,代码来源:LongPressOnElement.java


示例13: call

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
@Override
public Void call() throws Exception {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();

  touchScreen.move(x, y);

  return null;
}
 
开发者ID:alexkogon,项目名称:grid-refactor-remote-server,代码行数:9,代码来源:Move.java


示例14: call

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
@Override
public Void call() throws Exception {
  TouchScreen touchScreen = ((HasTouchScreen) getDriver()).getTouch();

  if (elementId != null) {
    WebElement element = getKnownElements().get(elementId);
    Coordinates elementLocation = ((Locatable) element).getCoordinates();
    touchScreen.scroll(elementLocation, xOffset, yOffset);
  } else {
    touchScreen.scroll(xOffset, yOffset);
  }
  return null;
}
 
开发者ID:alexkogon,项目名称:grid-refactor-remote-server,代码行数:14,代码来源:Scroll.java


示例15: getDescription

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
private DesiredCapabilities getDescription(WebDriver instance, Capabilities capabilities) {
  DesiredCapabilities caps = new DesiredCapabilities(capabilities.asMap());
  caps.setJavascriptEnabled(instance instanceof JavascriptExecutor);
  if (instance instanceof TakesScreenshot) {
    caps.setCapability(CapabilityType.TAKES_SCREENSHOT, true);
  }
  if (instance instanceof LocationContext) {
    caps.setCapability(CapabilityType.SUPPORTS_LOCATION_CONTEXT, true);
  }
  if (instance instanceof ApplicationCache) {
    caps.setCapability(CapabilityType.SUPPORTS_APPLICATION_CACHE, true);
  }
  if (instance instanceof NetworkConnection) {
    caps.setCapability(CapabilityType.SUPPORTS_NETWORK_CONNECTION, true);
  }
  if (instance instanceof WebStorage) {
    caps.setCapability(CapabilityType.SUPPORTS_WEB_STORAGE, true);
  }
  if (instance instanceof FindsByCssSelector) {
    caps.setCapability(CapabilityType.SUPPORTS_FINDING_BY_CSS, true);
  }
  if (instance instanceof Rotatable) {
    caps.setCapability(CapabilityType.ROTATABLE, true);
  }
  if (instance instanceof HasTouchScreen) {
    caps.setCapability(CapabilityType.HAS_TOUCHSCREEN, true);
  }
  return caps;
}
 
开发者ID:alexkogon,项目名称:grid-refactor-remote-server,代码行数:30,代码来源:DefaultSession.java


示例16: _clickAt

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
public boolean _clickAt( int offsetX, int offsetY )
{
    WebElement webElement = getElement();

    if ( webElement != null )
    {

        Dimension elementSize = webElement.getSize();

        int useX = (int) ((double) elementSize.getWidth() * ((double) offsetX / 100.0));
        int useY = (int) ((double) elementSize.getHeight() * ((double) offsetY / 100.0));

        if ( log.isInfoEnabled() )
            log.info( "Clicking " + useX + "," + useY + " pixels relative to " + getName() );

        if ( getWebDriver() instanceof HasInputDevices )
        {
            if ( isTimed() )
                getActionProvider().startTimer( (DeviceWebDriver) getWebDriver(), this, getExecutionContext() );

            if ( ((DeviceWebDriver) getWebDriver()).getNativeDriver() instanceof AppiumDriver )
            {
                new TouchAction( (AppiumDriver) ((DeviceWebDriver) getWebDriver()).getNativeDriver() ).moveTo( webElement ).tap( webElement, useX, useY ).perform();
            }
            else if ( ((DeviceWebDriver) getWebDriver()).getNativeDriver() instanceof RemoteWebDriver )
            {
                if ( ((DeviceWebDriver) getWebDriver()).getNativeDriver() instanceof HasTouchScreen )
                    new TouchActions( getWebDriver() ).moveToElement( webElement, useX, useY ).click().build().perform();
                else
                    new Actions( getWebDriver() ).moveToElement( webElement, useX, useY ).click().build().perform();
            }

            return true;
        }

        return true;
    }

    return false;

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


示例17: getTouch

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
@Override
public TouchScreen getTouch() {
    return ((HasTouchScreen) driver).getTouch();
}
 
开发者ID:codezombies,项目名称:easytest,代码行数:5,代码来源:DeviceWebDriver.java


示例18: checkHasTouchScreen

import org.openqa.selenium.interactions.HasTouchScreen; //导入依赖的package包/类
@Before
public void checkHasTouchScreen() {
  assumeThat(driver(), instanceOf(HasTouchScreen.class));
}
 
开发者ID:selendroid,项目名称:selendroid,代码行数:5,代码来源:TouchTestBase.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StreamingContext类代码示例发布时间:2022-05-22
下一篇:
Java RMDTSecretManagerState类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap