【问题标题】:Window 10: How to run script on Genymotion emulator with appium using eclipse窗口 10:如何在 Genymotion 模拟器上使用 eclipse 在 Appium 上运行脚本
【发布时间】:2017-02-04 15:22:51
【问题描述】:

请帮忙解决我的问题

  1. 从genymotion网站下载带有VirtualBox的Genymotion并正确安装
  2. 在eclipse上添加Genymotion插件并设置Genymotion目录
  3. 添加虚拟设备 Nexus9 os 版本 5.1.0 API 22
  4. 在项目下添加Selenium和Appium java客户端jar文件
  5. 使用 Genymotion Android Tool 和 Custom Android SDK tool 作为 Genymotion ADB 工具连接设置
  6. 配置 Appium 设置并运行 appium
  7. 在源码下面运行

    import java.io.IOException;
    import org.apache.commons.exec.CommandLine;
    import org.apache.commons.exec.DefaultExecuteResultHandler;
    import org.apache.commons.exec.DefaultExecutor;
    import org.apache.commons.exec.ExecuteException;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.remote.DesiredCapabilities;
    import org.openqa.selenium.remote.RemoteWebDriver;
    import java.net.URL;
    import io.appium.java_client.android.AndroidDriver;
    
    public class Firstappium {
    
        static String deviceName = "Nexus9-6.0.0-API23";
        static  WebDriver driver;;
    
        public static void main(String[] args) throws InterruptedException, ExecuteException, IOException {
    
            DesiredCapabilities capabilities = new DesiredCapabilities();        
            DefaultExecutor executor = new DefaultExecutor();
            DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
                    capabilities.setCapability("deviceName","Nexus9-5.1.0API22");   
            capabilities.setCapability("platformVersion", "5.1");
            capabilities.setCapability("platformName", "Android");
            capabilities.setCapability("app","G:/appium/apk/cz.hipercalc.apk");
    
            driver = new AndroidDriver(new URL("http://127.0.0.1:4720/wd/hub"),capabilities);
            System.out.println("SetUp is successful and Appium Driver is launched successfully");        
        }
    }
    
  8. 在 Appium 登录下方显示

信息:[调试] 1 个设备已连接 信息:发现设备 adb 服务器版本 (32) 与此客户端 (36) 不匹配;杀... 信息:[调试] 将设备 ID 设置为 adb 服务器版本 (32) 与此客户端 (36) 不匹配;杀... 信息:[调试] 等待设备准备好并响应 shell 命令(超时 = 5) info: [debug] 执行 cmd: G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36);杀... 等待设备 信息:[调试]重试restartAdb 错误:运行等待设备时出错 info: [debug] 执行 cmd: G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36);杀... 杀死服务器 错误:杀死ADB服务器时出错,去看看它是否在线 信息:[调试]正在连接设备... info: [debug] 执行 cmd: G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36);杀... 设备 信息:[调试] 等待设备准备好并响应 shell 命令(超时 = 5) info: [debug] 执行 cmd: G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36);杀... 等待设备 错误:运行等待设备时出错 信息:[调试]重试restartAdb info: [debug] 执行 cmd: G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36);杀... 错误:运行等待设备时出错 info: [debug] 执行 cmd: G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36);杀... 杀死服务器 错误:杀死ADB服务器时出错,去看看它是否在线 信息:[调试]正在连接设备... info: [debug] 执行 cmd: G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36);杀... 设备 信息:[调试] 等待设备准备好并响应 shell 命令(超时 = 5) info: [debug] 执行 cmd: G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36);杀... 等待设备 错误:运行等待设备时出错 info: [debug] 发送关闭命令,等待 UiAutomator 停止... 警告:UiAutomator 没有足够快地关闭,称它消失了 信息:[调试] 清理 android 对象 信息:[调试] 清理 appium 会话 错误:无法启动 Appium 会话,错误为:错误:命令失败:C:\WINDOWS\system32\cmd.exe /s /c "G:\Android\sdk\platform-tools\adb.exe -s adb server版本 (32) 与此客户端 (36) 不匹配;正在杀死... 等待设备” 错误:无法安装 smartsocket 侦听器:无法绑定到 127.0.0.1:5037:每个套接字地址(协议/网络地址/端口)通常只允许使用一次。 (10048) 无法从 ADB 服务器读取 ok * 无法启动服务器 *

info: [debug] 错误:命令失败:C:\WINDOWS\system32\cmd.exe /s /c "G:\Android\sdk\platform-tools\adb.exe -s adb server version (32)不匹配此客户 (36);杀死... 等待设备” 错误:无法安装 smartsocket 侦听器:无法绑定到 127.0.0.1:5037:每个套接字地址(协议/网络地址/端口)通常只允许使用一次。 (10048) 无法从 ADB 服务器读取 ok * 无法启动服务器 *

at ChildProcess.exithandler (child_process.js:751:12)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1016:16)
at Process.ChildProcess._handle.onexit (child_process.js:1088:5)

info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Command failed: C:\WINDOWS \system32\cmd.exe /s /c \"G:\Android\sdk\platform-tools\adb.exe -s adb 服务器版本 (32) 与此客户端 (36) 不匹配;正在杀死...\r wait-for-device\"\n错误:无法安装 smartsocket 侦听器:无法绑定到 127.0.0.1:5037:每个套接字地址(协议/网络地址/端口)通常只允许使用一次. (10048)\r\n无法从 ADB 服务器读取 ok\r\n* 无法启动服务器 *\r\n)","killed":false,"code":4294967295,"signal":null," cmd":"C:\WINDOWS\system32\cmd.exe /s /c \"G:\Android\sdk\platform-tools\adb.exe -s adb server version (32) 与此客户端不匹配 (36 );正在杀死...\r wait-for-device\"","origValue":"命令失败:C:\WINDOWS\system32\cmd.exe /s /c \"G:\Android\sdk\platform-tools\ adb.exe -s adb 服务器版本 (32) 与此客户端 (36) 不匹配;正在杀死...\r wait-for-device\"\n错误:无法安装 smartsocket 侦听器:无法绑定到 127.0.0.1:5037:每个套接字地址(协议/网络地址)只能使用一次/port) 通常是允许的。(10048)\r\n无法从 ADB 服务器读取 ok\r\n* 无法启动服务器 *\r\n"},"sessionId":null} 信息:

【问题讨论】:

    标签: eclipse appium genymotion


    【解决方案1】:

    从日志中我可以看到“adb 服务器版本不匹配”。

    尝试先通过ANDROID SDK MANAGER更新您的Android SDK。

    并且你需要在尝试初始化驱动之前启动appium server。

    当你启动 appium server 时,默认情况下它从端口号 4723 开始。

    如果您在启动 appium 服务器时没有提及任何端口号,那么 url 应该是 http://127.0.0.1:4723/wd/hub

    【讨论】:

      猜你喜欢
      • 2018-07-26
      • 2021-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-30
      • 1970-01-01
      • 1970-01-01
      • 2015-05-10
      相关资源
      最近更新 更多