【问题标题】:Swipe images through appium-android and to zoom通过 appium-android 滑动图像并缩放
【发布时间】:2015-10-16 21:29:32
【问题描述】:

几天前我开始学习 appium。以下是我的场景:

  1. 打开翻转卡
  2. 点击主菜单
  3. 滚动到手机
  4. 点击手机
  5. 点击特定的手机
  6. 点击移动图片并在图片之间滑动
  7. 缩放图像。

以下是我为上述场景实现的代码:

driver.findElement(By.className(properties.getProperty("home_menu_className"))).click();
    System.out.println("clicked on home menu");
    driver.findElement(By.className(properties.getProperty("home_menu_className"))).click();
    WebElement mobile = driver.scrollTo("Mobiles");
    System.out.println("scroll till Mobiles in home slider menu");
    mobile.click();
    driver.scrollTo("Top Offers!!").click();
    driver.scrollTo("Honor 4x").click();
    delay(4000);
    WebElement honor = driver.findElementById("com.flipkart.android:id/product_list_product_item_image");
    taction.tap(honor);
    driver.swipe(495,484, 52, 484, 12000);
    delay(12000);
    driver.zoom(164, 644);
    delay(8000);

当我运行上面的代码时,在同一页面上从右到左显示带有 x 轴和 y 轴的滑动动作。它不会在图像之间滑动,也不会缩放。

谁能告诉我具体的做法?

提前致谢。

【问题讨论】:

    标签: java android selenium-webdriver appium


    【解决方案1】:

    尝试使用 TouchAction 类来执行滑动功能。

    TouchAction action = new TouchAction(driver).longPress(x,y).moveTo(x, y).release();
    action.perform();
    

    【讨论】:

    • 我什至使用过 TouchAction 类,但由于无效坐标而出现错误。使用上面代码中提到的坐标。
    • 你从哪里得到这些坐标?
    • 通过在开发者选项中启用“显示指针位置”。并且每当我使用滑动或滚动方法时,都会收到错误 org.openqa.selenium.WebDriverException:An unknown server-side error occurred while processing the command。 (警告:服务器未提供任何堆栈跟踪信息)
    猜你喜欢
    • 1970-01-01
    • 2023-03-03
    • 1970-01-01
    • 2011-03-31
    • 1970-01-01
    • 2014-02-22
    • 2010-11-25
    • 2014-03-08
    • 1970-01-01
    相关资源
    最近更新 更多