Appium 找不到设备,重新启动 adb 服务器 [英] Appium could not find devices, restarting adb server

查看:83
本文介绍了Appium 找不到设备,重新启动 adb 服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于这个问题,我在网络和 stackoverflow 上都看过,关于这个话题有很多答案,但没有一个对我有用.

I have looked on both the net and on stackoverflow for this issue, there are quite a few answers on this topic but none of these have worked for me.

当我启动 Appium.exe 时,带有应用程序 (apk) 路径、包名称和活动的 Appium 控制台显示以下错误:

When I start Appium.exe, bearing the application (apk) path, package name and activity the Appium console displays the following error:

错误:错误:无法预启动 appium:错误:找不到已连接的 Android 设备

ERROR: error: Could not pre-launch appium: Error: Could not find a connected Android device

这甚至是在我开始编写任何代码之前.我过去曾用 Android Web 驱动程序做过一些工作,过去我从命令行使用过 android adb,没有任何问题.使用诸如adb devices"之类的命令行,我可以看到附加的物理设备 ID,并且能够从命令提示符安装和启动任何 apk,但这对 appium 不起作用.以前有人遇到过这个问题吗?

This is even before I get to code anything whatsoever. I have done some work with Android Web driver in the past and I have used the android adb from command line in the past with no issues at all. Using command line such as 'adb devices' I can see the physical device id attached as well as being able to install and launch any apks from commad prompt but yet this does not work with appium. Has anyone experienced this issue before?

我正在使用 Widows 7,我已经安装了 Android SDK 和工具,所有环境路径都设置为:

I am using Widows 7, I have Android SDK and tools already installed, all environment paths are set such as:

ANDROID_HOME:C:\sdk\sdk路径:C:\sdk\sdk\platform-tools

ANDROID_HOME: C:\sdk\sdk Path: C:\sdk\sdk\platform-tools

我将使用 selenium 在 C# 中编写应用程序测试(如果我让它工作的话).任何帮助将不胜感激.

I will be coding app tests in C# using selenium (if I ever get this to work that is). Any help will be much appreciated.

推荐答案

是的,所以 Appium 最挑剔的部分是 desired_capabilitiesserver_arguments.

Yes, so the most finnicky part of Appium is the desired_capabilities and server_arguments.

所以第一步:

  • 配置 Appium,以便服务器正常运行,然后您可以开始在代码中与其交互.

问题:

  • 您似乎在应用设置中勾选了预启动应用程序",这意味着 Appium 服务器一启动,就会尝试与手机或模拟器建立连接.

  • It seems that you have 'Prelaunch Application' checked in the App Settings, which means that as soon as the Appium server is started, it will attempt to establish a connection to the phone or emulator.

取消选中.

您将让您的测试实例化 WebDriver 会话,并使用 他们文档的这一部分

You're going to have your tests instantiate the WebDriver session, with the needed desired_capabilties as defined in this section of their documentation

这应该可以帮助你让它有点工作.

This should help you get it somewhat working.

我建议从命令行运行 Appium,这样您就可以最大程度地控制正在发生的事情.(如果这是一个可行的选择)

I would suggest running Appium from the command line, so you have the most control over what's going on. (If thats a viable option)

GUI 应用程序可能存在一些问题并忽略您提供的设置.

The GUI app may have some issues and ignore settings you give it.

这篇关于Appium 找不到设备,重新启动 adb 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆