【问题标题】:Appium server not detecting the device connected through wifiAppium服务器未检测到通过wifi连接的设备
【发布时间】:2018-12-28 12:49:15
【问题描述】:

做了 adb tcpip 5555adb connect ipaddressadb devices 显示设备。但是当我运行appium服务器时,它显示没有连接android设备。

appium python代码是

desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['deviceName'] = 'Android'
desired_caps['automationName'] = 'uiautomator2'
desired_caps['udid'] = 'xx.xx.xx.xx:5555'
desired_caps['platformVersion'] = '6.0.1'
desired_caps['appPackage'] = 'PackageName'
desired_caps['appActivity'] = 'activityName'

driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

appium服务器错误是

[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices...
[debug] [ADB] 0 device(s) connected
[debug] [ADB] Could not find devices, restarting adb server...
[debug] [ADB] Restarting adb
[debug] [ADB] Killing adb server on port 5037
[debug] [ADB] Getting connected devices...
[debug] [ADB] 0 device(s) connected

【问题讨论】:

    标签: adb appium appium-android python-appium


    【解决方案1】:

    找到了appium不断杀死adb服务器的原因并重新启动它。找到解决方案here。 如果 adb server 在没有 root 权限的情况下重新启动,那么 appium Server 将无法连接到真实设备。 使用 sudo 对我有用。

    【讨论】:

      【解决方案2】:

      我遇到了同样的问题。解决办法是,

      1. 在系统变量中设置 adb 路径(~/sdk/platform-tools)。因为我通过 wifi 连接设备的 ADB 路径(adb connect xx.xx.xx.xx:5555)与 ~/sdk/platform-tools 下的 adb 不同。
      2. 在代码中使用功能<i>capabilities.setCapability("suppressKillServer", true);</i>

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多