在Appium中运行测试时出错:“原始错误:错误:套接字挂起”

时间:2019-07-30 07:17:12

标签: java intellij-idea appium appium-android

我正在使用Appium在Android应用上用Java编写自动化程序,遇到了我无法解决的问题。

我有10个测试。当我一起运行它们,通过某些过程和完成某些课程时,结果是:

Original error: Error: socket hang up

有人知道如何解决此问题吗?

我正在运行测试的物理设备:

  • 小米Pocophone F1。
  • Android版本9。

添加此功能后,它开始发生:

cap.setCapability("automationName", "UiAutomator2");

这些是我的驱动程序设置:

package Settings;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import org.junit.Before;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.WebDriverWait;

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

public class DriverSettings {


    public AndroidDriver driver;
    public WebDriverWait wait;


    @Before
    public void driverSetUp() throws MalformedURLException {
        DesiredCapabilities cap = new DesiredCapabilities();
        cap.setCapability(MobileCapabilityType.DEVICE_NAME, "dac0bec9");
        cap.setCapability("platformName", "Android");
        cap.setCapability("platformVersion", "9");
        cap.setCapability("appPackage", "some package here");
        cap.setCapability("appActivity", "some activity here");
        cap.setCapability("appGrantPermissions", true);
        cap.setCapability(MobileCapabilityType.BROWSER_NAME, "");
        cap.setCapability("automationName", "UiAutomator2");

        driver = new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"), cap);
        wait = new WebDriverWait(driver, 15);
        driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);

    }

}

这是IntelliJ IDEA的例外:

Jul 30, 2019 10:15:26 AM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0
INFO: Detected dialect: W3C

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Unsupported log type 'driver'. Supported types: {"logcat":"Logs for Android applications on real device and emulators via ADB","bugreport":"'adb bugreport' output for advanced issues diagnostic","server":"Appium server logs"}
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'Michaels-MBP', ip: 'fe80:0:0:0:cdd:5f:3466:681%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.5', java.version: '1.8.0_201'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {appActivity: com.harel.harel_switch.Main..., appGrantPermissions: true, appPackage: com.harel.harel_switch, automationName: UiAutomator2, browserName: , databaseEnabled: false, desired: {appActivity: com.harel.harel_switch.Main..., appGrantPermissions: true, appPackage: com.harel.harel_switch, automationName: UiAutomator2, browserName: , deviceName: dac0bec9, platformName: android, platformVersion: 9}, deviceApiLevel: 28, deviceManufacturer: Xiaomi, deviceModel: POCOPHONE F1, deviceName: dac0bec9, deviceScreenDensity: 440, deviceScreenSize: 1080x2246, deviceUDID: dac0bec9, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, pixelRatio: 2.75, platform: LINUX, platformName: Android, platformVersion: 9, statBarHeight: 89, takesScreenshot: true, viewportRect: {height: 1938, left: 0, top: 89, width: 1080}, warnings: {}, webStorageEnabled: false}
Session ID: 747b44bc-d697-47a8-8f2e-5fd2f6f762d7

0 个答案:

没有答案