当前位置: 首页 > 知识库问答 >
问题:

Appium测试不在AWS设备场上运行,但在本地运行良好

和嘉澍
2023-03-14

我已经使用Appium和Java以及TestNG为Android应用程序编写了一些测试。我的测试在模拟器上本地运行良好,但当我将它们上传到设备场时,我的测试总是失败。我已经尽可能地简化了我的测试,但它仍然不起作用。目前,我尝试运行的测试会在打开应用程序时出现的提示中找到并单击“允许权限”按钮。代码:

package com.mycompany.app;

import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;

public class MyAppTest {

    public static AndroidDriver<MobileElement> driver;

    @BeforeClass
    public void Setup(){

        DesiredCapabilities cap = new DesiredCapabilities();

        try {
        driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), cap);
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }


    }
    @Test
    public void authTest() {        

    WebDriverWait wait = new WebDriverWait(driver, 60);
  wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("com.android.packageinstaller:id/permission_allow_button")));   

    MobileElement allowBtn = (MobileElement) driver.findElement(By.id("com.android.packageinstaller:id/permission_allow_button"));
    allowBtn.click();

    }

@AfterTest
    public void teardown() {

        driver.quit();

    }

观看Device Farm提供的视频,我可以看到它打开并立即关闭我的应用程序。它甚至没有像应该的那样等待。我在这里不知所措,花了好几个小时都没有运气。我唯一能想到的是,当我在将文件上传到设备场之前压缩文件时,Maven发生了一些事情。任何建议都将不胜感激。

编辑:Appium服务器日志(来自设备场)

   2018-08-09 19:21:52:790 - [debug] [MJSONWP] Calling AppiumDriver.findElements() with args: ["id","com.android.packageinstaller:id/permission_allow_button","e27184af-22d3-4a4e-8505-f2e47b35dc7f"]
2018-08-09 19:21:52:823 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2018-08-09 19:21:52:825 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2018-08-09 19:21:52:840 - [debug] [BaseDriver] Waiting up to 0 ms for condition
2018-08-09 19:21:52:936 - [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.packageinstaller:id/permission_allow_button","context":"","multiple":true}}
2018-08-09 19:21:52:960 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.packageinstaller:id/permission_allow_button","context":"","multiple":true}}
2018-08-09 19:21:52:962 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2018-08-09 19:21:52:963 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
2018-08-09 19:21:52:964 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.android.packageinstaller:id/permission_allow_button' using 'ID' with the contextId: '' multiple: true
2018-08-09 19:21:52:965 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
2018-08-09 19:21:52:966 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
2018-08-09 19:21:52:967 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (0)
2018-08-09 19:21:52:976 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
2018-08-09 19:21:52:977 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
2018-08-09 19:21:52:978 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.android.packageinstaller:id/permission_allow_button' using 'ID' with the contextId: '' multiple: true
2018-08-09 19:21:52:978 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
2018-08-09 19:21:52:979 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
2018-08-09 19:21:52:980 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (0)
2018-08-09 19:21:52:981 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
2018-08-09 19:21:52:981 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":[]}
2018-08-09 19:21:52:982 - [debug] [AndroidBootstrap] Received command result from bootstrap
2018-08-09 19:21:53:004 - [debug] [MJSONWP] Responding to client with driver.findElements() result: []
2018-08-09 19:21:53:018 - [HTTP] <-- POST /wd/hub/session/e27184af-22d3-4a4e-8505-f2e47b35dc7f/elements 200 247 ms - 74 
2018-08-09 19:21:53:600 - [HTTP] --> POST /wd/hub/session/e27184af-22d3-4a4e-8505-f2e47b35dc7f/elements {"using":"id","value":"com.android.packageinstaller:id/permission_allow_button"}
2018-08-09 19:21:53:602 - [debug] [MJSONWP] Calling AppiumDriver.findElements() with args: ["id","com.android.packageinstaller:id/permission_allow_button","e27184af-22d3-4a4e-8505-f2e47b35dc7f"]
2018-08-09 19:21:53:604 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2018-08-09 19:21:53:615 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2018-08-09 19:21:53:618 - [debug] [BaseDriver] Waiting up to 0 ms for condition
2018-08-09 19:21:53:620 - [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.packageinstaller:id/permission_allow_button","context":"","multiple":true}}
2018-08-09 19:21:53:651 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.packageinstaller:id/permission_allow_button","context":"","multiple":true}}
2018-08-09 19:21:53:652 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2018-08-09 19:21:53:652 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
2018-08-09 19:21:53:653 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.android.packageinstaller:id/permission_allow_button' using 'ID' with the contextId: '' multiple: true
2018-08-09 19:21:53:653 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
2018-08-09 19:21:53:666 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
2018-08-09 19:21:53:667 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (0)
2018-08-09 19:21:53:679 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
2018-08-09 19:21:54:032 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (1)
2018-08-09 19:21:54:042 - [debug] [AndroidBootstrap] Received command result from bootstrap
2018-08-09 19:21:54:045 - [debug] [MJSONWP] Responding to client with driver.findElements() result: [{"ELEMENT":"1"}]
2018-08-09 19:21:54:064 - [HTTP] <-- POST /wd/hub/session/e27184af-22d3-4a4e-8505-f2e47b35dc7f/elements 200 446 ms - 89 
2018-08-09 19:21:54:079 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[INSTANCE=1, RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
2018-08-09 19:21:54:085 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":[{"ELEMENT":"1"}]}
2018-08-09 19:21:54:160 - [HTTP] --> DELETE /wd/hub/session/e27184af-22d3-4a4e-8505-f2e47b35dc7f {}
2018-08-09 19:21:54:162 - [debug] [MJSONWP] Calling AppiumDriver.deleteSession() with args: ["e27184af-22d3-4a4e-8505-f2e47b35dc7f"]
2018-08-09 19:21:54:163 - [debug] [BaseDriver] Event 'quitSessionRequested' logged at 1533842514163 (19:21:54 GMT+0000 (UTC))
2018-08-09 19:21:54:174 - [Appium] Removing session e27184af-22d3-4a4e-8505-f2e47b35dc7f from our master session list
2018-08-09 19:21:54:178 - [debug] [AndroidDriver] Shutting down Android driver

从本地测试成功获取Appium服务器日志:

[debug] [MJSONWP] Calling AppiumDriver.findElements() with args: ["id","com.android.packageinstaller:id/permission_allow_button","8e38c406-877d-470b-a6c8-7df870d0a94b"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.packageinstaller:id/permission_allow_button","context":"","multiple":true}}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.packageinstaller:id/permission_allow_button","context":"","multiple":true}}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.android.packageinstaller:id/permission_allow_button' using 'ID' with the contextId: '' multiple: true
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (0)
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (1)
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[INSTANCE=1, RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":[{"ELEMENT":"1"}]}
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [MJSONWP] Responding to client with driver.findElements() result: [{"ELEMENT":"1"}]
[HTTP] <-- POST /wd/hub/session/8e38c406-877d-470b-a6c8-7df870d0a94b/elements 200 7373 ms - 89
[HTTP] --> GET /wd/hub/session/8e38c406-877d-470b-a6c8-7df870d0a94b/element/1/displayed {}
[debug] [MJSONWP] Calling AppiumDriver.elementDisplayed() with args: ["1","8e38c406-877d-470b-a6c8-7df870d0a94b"]
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:getAttribute","params":{"attribute":"displayed","elementId":"1"}}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:getAttribute","params":{"attribute":"displayed","elementId":"1"}}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getAttribute
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [MJSONWP] Responding to client with driver.elementDisplayed() result: true
[HTTP] <-- GET /wd/hub/session/8e38c406-877d-470b-a6c8-7df870d0a94b/element/1/displayed 200 295 ms - 76
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":"true"}
[HTTP] --> POST /wd/hub/session/8e38c406-877d-470b-a6c8-7df870d0a94b/element {"using":"id","value":"com.android.packageinstaller:id/permission_allow_button"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.android.packageinstaller:id/permission_allow_button","8e38c406-877d-470b-a6c8-7df870d0a94b"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.packageinstaller:id/permission_allow_button","context":"","multiple":false}}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.packageinstaller:id/permission_allow_button","context":"","multiple":false}}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.android.packageinstaller:id/permission_allow_button' using 'ID' with the contextId: '' multiple: false
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"2"}
[HTTP] <-- POST /wd/hub/session/8e38c406-877d-470b-a6c8-7df870d0a94b/element 200 18 ms - 87
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":{"ELEMENT":"2"}}
[HTTP] --> POST /wd/hub/session/8e38c406-877d-470b-a6c8-7df870d0a94b/element/2/click {"id":"2"}
[debug] [MJSONWP] Calling AppiumDriver.click() with args: ["2","8e38c406-877d-470b-a6c8-7df870d0a94b"]
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:click","params":{"elementId":"2"}}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"2"}}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: click
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [MJSONWP] Responding to client with driver.click() result: true
[HTTP] <-- POST /wd/hub/session/8e38c406-877d-470b-a6c8-7df870d0a94b/element/2/click 200 3223 ms - 76
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":true}
[HTTP] --> POST /wd/hub/session/8e38c406-877d-470b-a6c8-7df870d0a94b/element/2/click {"id":"2"}
[debug] [MJSONWP] Calling AppiumDriver.click() with args: ["2","8e38c406-877d-470b-a6c8-7df870d0a94b"]
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:click","params":{"elementId":"2"}}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"2"}}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: click
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [MJSONWP] Responding to client with driver.click() result: true
[HTTP] <-- POST /wd/hub/session/8e38c406-877d-470b-a6c8-7df870d0a94b/element/2/click 200 3377 ms - 76
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":true}
[HTTP] --> DELETE /wd/hub/session/8e38c406-877d-470b-a6c8-7df870d0a94b {}
[debug] [MJSONWP] Calling AppiumDriver.deleteSession() with args: ["8e38c406-877d-470b-a6c8-7df870d0a94b"]
[debug] [BaseDriver] Event 'quitSessionRequested' logged at 1533841411213 (14:03:31 GMT-0500 (Central Daylight Time))
[Appium] Removing session 8e38c406-877d-470b-a6c8-7df870d0a94b from our master session list
[debug] [AndroidDriver] Shutting down Android driver

共有2个答案

安星汉
2023-03-14

如果使用uiautomator2在本地运行测试,还应在设备场中将automationName功能设置为uiautomator2

最初,我在使用device farm时遇到了同样的挑战,但设置此功能解决了我的问题。

capabilities.setCapability("automationName", "uiautomator2");

此外,您无需与设备交互即可授予应用程序任何权限。这可以通过设置autoGrantPermissions功能无缝完成。它将为你的应用授予所有必需的权限。

capabilities.setCapability("autoGrantPermissions",true);
颛孙安康
2023-03-14

很抱歉耽搁了。我用这个应用程序编写了这个测试,这些方法在Device farm(测试视频)中似乎很成功。

测试类

package Tests;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;

import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;

public class DismissPopupTest{

     /**
     * Make the driver static. This allows it to be created only once
     * and used across all of the test classes.
     */
    public static AndroidDriver<MobileElement> driver;

    /**
     * This method runs before any other method.
     *
     * Appium follows a client - server model:
     * We are setting up our appium client in order to connect to Device Farm's appium server.
     *
     * We do not need to and SHOULD NOT set our own DesiredCapabilities
     * Device Farm creates custom settings at the server level. Setting your own DesiredCapabilities
     * will result in unexpected results and failures.
     *
     * @throws MalformedURLException An exception that occurs when the URL is wrong
     */
    @BeforeSuite
    public void setUpAppium() throws MalformedURLException {

        final String URL_STRING = "http://127.0.0.1:4723/wd/hub";

        URL url = new URL(URL_STRING);

        //Use a empty DesiredCapabilities object fro device farm
        DesiredCapabilities capabilities = new DesiredCapabilities();

        driver = new AndroidDriver<MobileElement>(url, capabilities);

        //Use a higher value if your mobile elements take time to show up
        driver.manage().timeouts().implicitlyWait(35, TimeUnit.SECONDS);
    }

    @Test
    public void authTest() {        

        WebDriverWait wait = new WebDriverWait(driver, 60);
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("com.android.packageinstaller:id/permission_allow_button")));   

        MobileElement allowBtn = (MobileElement) driver.findElement(By.id("com.android.packageinstaller:id/permission_allow_button"));
        allowBtn.click();

    }



    /**
     * Always remember to quit
     */
    @AfterSuite
    public void tearDownAppium() {
        driver.quit();
    }

    /**
     * Restart the app after every test class to go back to the main
     * screen and to reset the behavior
     */
    @AfterClass
    public void restartApp() {
        driver.resetApp();
    }
}

Appium服务器日志显示在驱动程序上设置了隐式等待,并且找到了元素。

Appium服务器日志

2018-08-27 04:35:19:589 - [HTTP] --> POST /wd/hub/session/2feb5200-b336-47d5-94ba-63c45d749af8/timeouts/implicit_wait {"ms":35000}
2018-08-27 04:35:19:627 - [debug] [MJSONWP] Calling AppiumDriver.implicitWait() with args: [35000,"2feb5200-b336-47d5-94ba-63c45d749af8"]
2018-08-27 04:35:19:630 - [debug] [BaseDriver] Set implicit wait to 35000ms
2018-08-27 04:35:19:631 - [debug] [MJSONWP] Responding to client with driver.implicitWait() result: null
2018-08-27 04:35:19:652 - [HTTP] <-- POST /wd/hub/session/2feb5200-b336-47d5-94ba-63c45d749af8/timeouts/implicit_wait 200 44 ms - 76 
2018-08-27 04:35:19:725 - [HTTP] --> POST /wd/hub/session/2feb5200-b336-47d5-94ba-63c45d749af8/element {"using":"id","value":"com.android.packageinstaller:id/permission_allow_button"}
2018-08-27 04:35:19:727 - [debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.android.packageinstaller:id/permission_allow_button","2feb5200-b336-47d5-94ba-63c45d749af8"]
2018-08-27 04:35:19:728 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2018-08-27 04:35:19:729 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2018-08-27 04:35:19:730 - [debug] [BaseDriver] Waiting up to 35000 ms for condition
2018-08-27 04:35:19:764 - [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.packageinstaller:id/permission_allow_button","context":"","multiple":false}}
2018-08-27 04:35:19:785 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.packageinstaller:id/permission_allow_button","context":"","multiple":false}}
2018-08-27 04:35:19:821 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2018-08-27 04:35:19:822 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
2018-08-27 04:35:19:822 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.android.packageinstaller:id/permission_allow_button' using 'ID' with the contextId: '' multiple: false
2018-08-27 04:35:19:823 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
2018-08-27 04:35:20:000 - [debug] [AndroidBootstrap] Received command result from bootstrap
2018-08-27 04:35:20:002 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":{"ELEMENT":"1"}}
2018-08-27 04:35:20:007 - [debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"1"}
2018-08-27 04:35:20:032 - [HTTP] <-- POST /wd/hub/session/2feb5200-b336-47d5-94ba-63c45d749af8/element 200 298 ms - 87

然后单击该元素,弹出窗口被驳回

2018-08-27 04:35:20:113 - [HTTP] --> GET /wd/hub/session/2feb5200-b336-47d5-94ba-63c45d749af8/element/1/displayed {}
2018-08-27 04:35:20:114 - [debug] [MJSONWP] Calling AppiumDriver.elementDisplayed() with args: ["1","2feb5200-b336-47d5-94ba-63c45d749af8"]
2018-08-27 04:35:20:116 - [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:getAttribute","params":{"attribute":"displayed","elementId":"1"}}
2018-08-27 04:35:20:145 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:getAttribute","params":{"attribute":"displayed","elementId":"1"}}
2018-08-27 04:35:20:145 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2018-08-27 04:35:20:146 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getAttribute
2018-08-27 04:35:20:162 - [debug] [AndroidBootstrap] Received command result from bootstrap
2018-08-27 04:35:20:163 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":"true"}
2018-08-27 04:35:20:163 - [debug] [MJSONWP] Responding to client with driver.elementDisplayed() result: true
2018-08-27 04:35:20:178 - [HTTP] <-- GET /wd/hub/session/2feb5200-b336-47d5-94ba-63c45d749af8/element/1/displayed 200 76 ms - 76 
2018-08-27 04:35:20:180 - [HTTP] --> POST /wd/hub/session/2feb5200-b336-47d5-94ba-63c45d749af8/element {"using":"id","value":"com.android.packageinstaller:id/permission_allow_button"}
2018-08-27 04:35:20:180 - [debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.android.packageinstaller:id/permission_allow_button","2feb5200-b336-47d5-94ba-63c45d749af8"]
2018-08-27 04:35:20:181 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2018-08-27 04:35:20:182 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2018-08-27 04:35:20:182 - [debug] [BaseDriver] Waiting up to 35000 ms for condition
2018-08-27 04:35:20:203 - [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.packageinstaller:id/permission_allow_button","context":"","multiple":false}}
2018-08-27 04:35:20:218 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.packageinstaller:id/permission_allow_button","context":"","multiple":false}}
2018-08-27 04:35:20:235 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2018-08-27 04:35:20:235 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
2018-08-27 04:35:20:236 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.android.packageinstaller:id/permission_allow_button' using 'ID' with the contextId: '' multiple: false
2018-08-27 04:35:20:251 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.android.packageinstaller:id/permission_allow_button]
2018-08-27 04:35:20:258 - [debug] [AndroidBootstrap] Received command result from bootstrap
2018-08-27 04:35:20:286 - [debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"2"}
2018-08-27 04:35:20:290 - [HTTP] <-- POST /wd/hub/session/2feb5200-b336-47d5-94ba-63c45d749af8/element 200 107 ms - 87 
2018-08-27 04:35:20:311 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":{"ELEMENT":"2"}}
2018-08-27 04:35:20:312 - [HTTP] --> POST /wd/hub/session/2feb5200-b336-47d5-94ba-63c45d749af8/element/2/click {"id":"2"}
2018-08-27 04:35:20:313 - [debug] [MJSONWP] Calling AppiumDriver.click() with args: ["2","2feb5200-b336-47d5-94ba-63c45d749af8"]
2018-08-27 04:35:20:329 - [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:click","params":{"elementId":"2"}}
2018-08-27 04:35:20:348 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"2"}}
2018-08-27 04:35:20:368 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2018-08-27 04:35:20:384 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: click
2018-08-27 04:35:23:548 - [debug] [AndroidBootstrap] Received command result from bootstrap
2018-08-27 04:35:23:550 - [debug] [MJSONWP] Responding to client with driver.click() result: true
2018-08-27 04:35:23:568 - [HTTP] <-- POST /wd/hub/session/2feb5200-b336-47d5-94ba-63c45d749af8/element/2/click 200 3238 ms - 76 

考虑到目前为止的所有信息,可能是代码测试包或结果混淆了。

我希望这有帮助。

-詹姆斯

 类似资料:
  • 我正在评估运行移动web测试的AWS设备场。以下是我预期的步骤: 创建样本测试(Java) 打包为zip文件 通过AWS设备场控制台,仅上传测试zip 手动选择配置和其他东西 手动执行测试并评估结果 我需要帮助的事情是: a)如果测试需要一些更改,我是否需要在每次运行中完成JAR包的创建?我可以从我的IDE运行测试,如果一切正常,然后只打包并上传到AWS设备场? b) 我注意到他们有API来模拟步

  • 我创建了一个JasperReport应用程序,它在tomcat服务器上运行良好。但是当我使用相同的jar在Jboss上运行时,它会显示错误 原因:java.lang.ClassCastException:org.apache.xerces.jaxp.DocumentBuilderFactoryImpl无法强制转换为javax.xml.parsers.DocumentBuilderFactor.ne

  • 我试图让我的硒测试在詹金斯运行,但面临以下问题。当使用maven test或intellij运行时,测试在我的本地计算机上运行得很好。 Firefox 39 x64 Selenium 2.46.0 SeleniumHQ插件(自动更新,所以应该是最新版本) 根据这个Xvfb服务器应该正在运行 问题出在哪里?我在网上搜索了两天,尝试了几乎所有我找到的东西后,我想不出来了。 资料来源: 错误:

  • 我使用的是Appium Version1.9.1和基于Appium Java TestNG的框架构建,但是当我在真实设备上的AWS设备场上执行I时,我会得到以下错误: WebDriverException:处理命令时发生未知的服务器端错误。原始错误:未处理的endpoint:/session/bc6e4901-43a6-4c66-913a-ebaf8482dd4b/wda/screen-http:

  • 这是我的第一篇帖子,请原谅我没有提供您需要帮助我的所有正确信息。 我创建了一个使用Spring安全性的Spring启动后端服务器Rest API。当我通过我的反应项目调用这个api时,我最初得到一个500状态响应,告诉我请求已被CORS阻止。我解决了以下corsConfig文件的问题: 当我运行react项目(localhost:3000)和spring api(localhost:8080)时,

  • 我试图在AWS设备场上运行一个测试套件,它是一个Maven项目,我在设备场解析结果文档上得到以下错误:[TestNG]无法在jar文件中找到TestNG.xml,运行所有类。当从Maven为AWS设备场创建zip时,我得到以下警告:[WARNING]org.testng:testng:jar:5.14.3的POM无效,传递依赖项(如果有)将不可用,请启用调试日志以了解更多详细信息。我有最新版本的t