在Windows 7 Android真实设备上使用Appium 1.2.0.1进行本机浏览器自动化:找不到连接的Android设备 [英] Native Browser Automation using Appium 1.2.0.1 on Windows 7 Android real device: Could not find a connected Android device

查看:94
本文介绍了在Windows 7 Android真实设备上使用Appium 1.2.0.1进行本机浏览器自动化:找不到连接的Android设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这个问题上看过很多论坛,关于这个主题的答案很多,但是没有一个对我有用/符合我的标准.

I have looked many forums for this issue, there are quite a few answers on this topic but none of these have worked for me/match my criteria.

我最近承担了Mobile Automation的任务,因此对Appium来说是全新的.我正在Windows 7上使用Appium 1.2.0.1,并尝试在Android v4.3真实设备上自动执行本机Android浏览器(不是Chrome或App). 我已经按照说明安装了所有东西.我在JUnit Framework的Maven Build中使用Selenium通过Appium执行脚本.我在管理员模式下使用Appuim.exe,并使用GUI启动节点.然后我运行我的脚本.

I recently took up Mobile Automation task and hence am completely new to Appium. I am working with Appium 1.2.0.1 on Windows 7 and trying to automate the native Android Browser(not Chrome or an App) on an Android v4.3 real device. I have installed everything according to the instructions. I am using Selenium in Maven Build in JUnit Framework to execute the scripts through Appium. I use Appuim.exe in Admin mode and use the GUI to start the node. Then I run my scripts.

我的问题是,当我在cmd中尝试"adb设备"时,我能够看到该设备.而在执行过程中,Appium会引发错误无法启动Appium会话,错误是:错误:找不到已连接的Android设备."我尝试了许多故障排除选项,并验证了是否一切就绪.没运气.请帮忙.

My issue is that when I try "adb devices" in cmd, I am able to see the device. Whereas, during execution, Appium is throwing an Error "Failed to start an Appium session, err was: Error: Could not find a connected Android device." I tried many troubleshooting options and verified if everything is in place. No luck. Please help.

下面是错误的踪迹:

> Checking if an update is available
> Update not available
> Starting Node Server
> info: Welcome to Appium v1.2.0 (REV e53f49c706a25242e66d36685c268b599cc18da5)
> debug: Non-default server args: {"address":"127.0.0.1","fullReset":true,"logNoColors":true,"platformName":"Android","platformVersion":"18","automationName":"Appium","browserName":"Browser"}
> info: Appium REST http interface listener started on 127.0.0.1:4723
> info: LogLevel: debug
> info: --> POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.3","browserName":"Browser","platformName":"Android","device":"Android","deviceName":"Android"}}
> debug: Appium request initiated at /wd/hub/session
> info: Retrieving device
> warn:  code=ENOENT, errno=ENOENT, syscall=spawn
> debug: Request received with params: {"desiredCapabilities":{"platformVersion":"4.3","browserName":"Browser","platformName":"Android","device":"Android","deviceName":"Android"}}
> debug: The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : device
> debug: Looks like we want chrome on android
> debug: Creating new appium session fa19e382-c178-4e6b-8150-a386a51bee39
> debug: Preparing device for session
> debug: Not checking whether app is present since we are assuming it's already on the device
> debug: Checking whether adb is present
> debug: Using adb from C:\Android\android-sdk\platform-tools\adb.exe
> debug: Trying to find a connected android device
> debug: Getting connected devices...
> debug: executing: "C:\Android\android-sdk\platform-tools\adb.exe" devices
> debug: Could not find devices, restarting adb server...
> debug: executing: "C:\Android\android-sdk\platform-tools\adb.exe" kill-server
> warn:  code=ENOENT, errno=ENOENT, syscall=spawn
> warn:  code=ENOENT, errno=ENOENT, syscall=spawn
> debug: Getting connected devices...
> debug: executing: "C:\Android\android-sdk\platform-tools\adb.exe" devices
> debug: Could not find devices, restarting adb server...
> debug: executing: "C:\Android\android-sdk\platform-tools\adb.exe" kill-server
> error: Error killing ADB server, going to see if it's online anyway
> debug: Getting connected devices...
> debug: executing: "C:\Android\android-sdk\platform-tools\adb.exe" devices
> debug: Could not find devices, restarting adb server...
> warn:  code=ENOENT, errno=ENOENT, syscall=spawn
> warn:  code=ENOENT, errno=ENOENT, syscall=spawn
> debug: executing: "C:\Android\android-sdk\platform-tools\adb.exe" kill-server
> warn:  code=ENOENT, errno=ENOENT, syscall=spawn
> error: Error killing ADB server, going to see if it's online anyway
> warn:  code=ENOENT, errno=ENOENT, syscall=spawn
> info: <-- POST /wd/hub/session 500 20314.056 ms - 206 
> debug: Getting connected devices...
> debug: executing: "C:\Android\android-sdk\platform-tools\adb.exe" devices
> debug: Cleaning up appium session
> error: Failed to start an Appium session, err was: Error: Could not find a connected Android device.
> debug: Error: Could not find a connected Android device.
>     at ADB.getDevicesWithRetry (C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:600:15)
>     at androidCommon.prepareActiveDevice (C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\lib\devices\android\android-common.js:349:12)
>     at null.<anonymous> (C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\lib\devices\android\android-common.js:289:26)
>     at C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\async\lib\async.js:610:21
>     at C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\async\lib\async.js:249:17
>     at iterate (C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\async\lib\async.js:149:13)
>     at C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\async\lib\async.js:160:25
>     at C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\async\lib\async.js:251:21
>     at C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\async\lib\async.js:615:34
>     at androidCommon.prepareEmulator (C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\lib\devices\android\android-common.js:339:5)
> debug: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not find a connected Android device.)","origValue":"Could not find a connected Android device."},"sessionId":null}

这是我的代码:

if (runEnv.equals("Android")) 
        {
            DesiredCapabilities capabilities = new DesiredCapabilities();
              capabilities.setCapability("device","Android");
              capabilities.setCapability("deviceName","Android");
              capabilities.setCapability("platformName","Android");
              capabilities.setCapability("browserName", "Browser");
              capabilities.setCapability("platformVersion", "4.3");

              try {
                driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }

            driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
        }

请帮助!

谢谢, Arpitha

Thanks, Arpitha

推荐答案

在运行adb devies命令时,在deviceName字段中复制并粘贴在cmd窗口中提供的ID.

In the deviceName field copy and paste the id given in the cmd window when you run the adb devies command.

这篇关于在Windows 7 Android真实设备上使用Appium 1.2.0.1进行本机浏览器自动化:找不到连接的Android设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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