如何在Amazon云中运行移动的自动化代码(Selenium + Appium)

jjjwad0x  于 2023-03-12  发布在  其他
关注(0)|答案(1)|浏览(206)

我想在亚马逊云上运行我的移动的自动化代码,我是用Appium和Selenium webdriver设计我的代码的。它在我的本地使用模拟器或Live设备运行良好。我的移动自动化代码像:

File classpathRoot = new File(System.getProperty("user.dir"));
    File appDir = new File(classpathRoot, "/apps");
    File app = new File(appDir, "/siteaudit.apk");

    System.out.println("Complete path : "+app);

    DesiredCapabilities capabilities = new DesiredCapabilities();
    //capabilities.setCapability("deviceName", "LG_Nexus_4_E960_real");
    //capabilities.setCapability("deviceName", "Spice Mi-498");
    //capabilities.setCapability("deviceName", "Nexus 5");

    capabilities.setCapability("deviceName", "LG Nexus 5");
    capabilities.setCapability("platformVersion", "6.0");

    capabilities.setCapability("app", app.getAbsolutePath());

    /*capabilities.setCapability("appPackage", "io.appium.android.apis");
    capabilities.setCapability("appActivity", ".ApiDemos");*/

    capabilities.setCapability("appPackage", "com.youtility.attendance.ui");
    capabilities.setCapability("appActivity", ".ServerURLActivity");

    driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
velaa5lx

velaa5lx1#

正如评论中提到的,请参考AWS Device Farm TestNG documentation,我见过的两个最常见的问题是:

  • 测试和依赖项的打包不正确。
  • 设置DesiredCapabilities,设备场在测试执行前构造自己的DesiredCapabilities;如果还设置了该对象的值,则系统行为未定义。

我最近介绍了X1 E1 F1 X,它介绍了设备场中Appium测试的创建和执行。我建议查看它以获得额外的指导。

相关问题