0

我正在尝试在 Amazon Web Services Device Farm 上测试一个混合应用程序。它崩溃了。混合应用程序的 Appium 测试是否适用于 AWS Device Farm?他们说他们工作......但他们总是工作吗?

我的猜测是崩溃与 AWS chromedriver 和设备 chrome 版本之间的不一致有关,但我不知道这是否正确。

我想知道是否有任何 Appium Capability 或其他东西可以修复混合应用程序上的 webview 错误。我找不到任何类似的例子。

测试因以下错误而崩溃:

test failed: An unknown server-side error occurred while processing the command. Original error: Error occured while starting App. Original error: Error executing adbExec. 
Original error: 'Command '/opt/dev/android-sdk-linux/platform-tools/adb -P 5037 -s FA75W0301076 shell am start -W -n com.hola.mundo/.MainActivity -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000' timed out after 20000ms'; Stderr: ''; Code: 'null' (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 100.72 seconds Build info: version: '2.46.0', revision: 
'61506a4624b13675f24581e453592342b7485d71', time: '2015-06-04 10:22:50' System info: host: 'ip-172-31-13-65', ip: '172.31.13.65', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-53-generic', java.version: '1.8.0_131' Driver info: io.appium.java_client.android.AndroidDriver

在日志中,我可以找到此消息:

Device01:16.640  9187  Error  WebViewFactory  Chromium WebView package does not exist

我以这种方式创建了一个简单的“hello world”apk:

cordova create holamundo com.hola.mundo holamundo
cd holamundo/
cordova platform add android
cordova run android

这是 Java Appium 测试。它可以在我本地的设备上运行。测试只是从 cordova 应用程序中读取默认的 div 文本。我在 MacOS High Sierra 上有 Appium 版本 1.7.1 和 cordova 版本 7.1.0。这是测试。

public class LoginPage extends BasePage {
    public LoginPage loginPage() throws InterruptedException {
        try {
            Set<String> contextNames = webdriver.getContextHandles();
            System.out.println(contextNames);
            webdriver.context(AndroidSetup.Contexts.WEBVIEW);
            WebElement loginButton = webdriver.findElement(By.id("deviceready"));
            System.out.println("button text: " + loginButton.getText() );
            takeScreenshot("", "pantallazo.png");
            Assert.assertEquals(loginButton.getText(), "DEVICE IS READY");
        }catch (Exception ex){
            ex.printStackTrace();
        }
        return new LoginPage(driver);
    }

    public void takeScreenshot(String path_screenshot, String filename) throws IOException {
        String currentContext = webdriver.getContext();
        System.out.println("current context: " + currentContext + " switching to " + AndroidSetup.Contexts.NATIVE);
        webdriver.context(AndroidSetup.Contexts.NATIVE);
        File srcFile=webdriver.getScreenshotAs(OutputType.FILE);
        File targetFile=new File(path_screenshot + filename);
        FileUtils.copyFile(srcFile,targetFile);
        webdriver.context(currentContext);
        System.out.println("current context: " + webdriver.getContext());
    }
}

我已经在 Amazon Web Services Device Farm、Google Pixel、Samsung Galaxy S8 和 LGE LG V20 上打包并运行了相同的测试。该测试适用于 LG,但会在 Google Pixel 和三星手机中崩溃。

编辑:这是现在在 AWS Device Farm 上选择 Appium 版本的菜单。该错误发生在所有三个版本上。

Appium版本选择

4

1 回答 1

0

AWS 设备场支持 Appium 服务器1.6.31.6.51.4.16.

因此,如果它在本地适用于您的 appium 服务器1.7.1(具有最新的 chromedriver 版本),则不能保证它适用于云中的旧版本:在本地降级到 1.6.5 并查看它是否仍然适用于旧版 chromedriver。

AWS Device Farm 会忽略代码中设置的任何功能,因此如果在运行设置期间 AWS UI 上没有任何内容 => 那么您无法设置功能,例如chromedriverExecutable使用自定义 chromedriver 二进制文件

于 2017-12-21T21:14:24.730 回答