【问题标题】:Appium - Scrolling methods are not working in landscape mode for IOSAppium - 滚动方法在 IOS 的横向模式下不起作用
【发布时间】:2018-08-23 06:32:03
【问题描述】:

下面提到的滚动方法在纵向模式下工作正常,但在横向模式下滚动方法不适用于 IOS。

Appium 版本:1.7.1

IOS版本:11.2

模拟器/真实设备:模拟器 - iPhone SE

请帮忙!!

@Test
public  void ScrollWithElementByName(RemoteWebDriver driver, String XPath) throws InterruptedException
{
    RemoteWebElement elements =  (RemoteWebElement) driver.findElement(By.name(XPath));
    JavascriptExecutor js = (JavascriptExecutor) driver;
    HashMap<String, String> scrollObject = new HashMap<String, String>();
    scrollObject.put("element", ((RemoteWebElement) elements).getId());
    scrollObject.put("toVisible", "true");
    js.executeScript("mobile: scroll", scrollObject);
}

@Test
public void ScrollWithoutElement(RemoteWebDriver driver) throws InterruptedException
{
    Dimension size = driver.manage().window().getSize();       
    JavascriptExecutor js = (JavascriptExecutor) driver;
    HashMap<String, String> scrollObject = new HashMap<String, String>();
    scrollObject.put("direction", "down");
    js.executeScript("mobile: scroll", scrollObject);
    scrollObject.put("direction", "up");
    js.executeScript("mobile: scroll", scrollObject);
}

【问题讨论】:

    标签: javascript selenium appium appium-ios appium-desktop


    【解决方案1】:

    我遇到了同样的问题。就我而言,问题是应用程序从纵向模式获取坐标,即使它处于横向模式。所以请检查纵向模式和横向模式下的坐标是否相同.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-06
      • 1970-01-01
      • 2023-03-11
      • 1970-01-01
      • 1970-01-01
      • 2021-02-20
      相关资源
      最近更新 更多