首页 文章

混合应用程序在Amazon Web Service Appium测试中崩溃

提问于
浏览
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和谷歌Pixel和三星手机的崩溃 .

编辑:这是立即在AWS Device Farm上选择Appium版本的菜单 . 所有三个版本都会发生错误 .

Appium version selection

1 回答

  • 0

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

    因此,如果它适用于本地appium server 1.7.1 (具有最近的chromedriver版本),则无法保证它可以在 Cloud 中的旧版本上运行:在本地降级到1.6.5并查看它是否仍适用于较旧的chromedriver .

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

相关问题