Appium - 滚动方法在 IOS 的横向模式下不起作用
Appium - Scrolling methods are not working in landscape mode for IOS
下面提到的滚动方法在纵向模式下工作正常,但在横向模式下滚动方法不适用于 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);
}
我遇到了同样的问题 issue.In 我的情况,问题是应用程序正在从纵向模式获取坐标,即使它是横向的 mode.So 请检查纵向模式和横向模式的坐标是否相同
下面提到的滚动方法在纵向模式下工作正常,但在横向模式下滚动方法不适用于 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);
}
我遇到了同样的问题 issue.In 我的情况,问题是应用程序正在从纵向模式获取坐标,即使它是横向的 mode.So 请检查纵向模式和横向模式的坐标是否相同