Appium Appium 报错求助

· July 02, 2015 · Last by 陈恒捷 replied at July 03, 2015 · 1694 hits

难得问个问题,最近想做适配性的脚本编写。想到 4.1 以下 Android 机型用 selendroid 模式,于是搞起来。我的脚本很简单,如下

# -*- coding: utf-8 -*-
__author__ = 'Administrator'

from appium import webdriver
from time import sleep


desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['automationName'] = "Selendroid"
desired_caps['platformVersion'] = '4.1'
desired_caps['deviceName'] = '192.168.56.101:5555'
#desired_caps['app'] = 'Calculator.apk'
desired_caps['appPackage'] = 'com.tongbanjie.android'
desired_caps['appActivity'] = '.TBJMainFragmentActivity'

dr = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)

#进入更多模块
dr.implicitly_wait(4)
more=dr.find_element_by_id("com.tongbanjie.android:id/tab_more")
dr.close_app()
dr.quit()

#pycharm 报错

C:\Python27\python.exe D:/appium/testseleroid.py
Traceback (most recent call last):
  File "D:/appium/testseleroid.py", line 17, in <module>
    dr = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
  File "C:\Python27\lib\site-packages\appium\webdriver\webdriver.py", line 35, in __init__
    super(WebDriver, self).__init__(command_executor, desired_capabilities, browser_profile, proxy, keep_alive)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 89, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 138, in start_session
    'desiredCapabilities': desired_capabilities,
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 195, in execute
    self.error_handler.check_response(response)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 170, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: A new session could not be created. (Original error: hasInternetPermissionFromManifest failed. Error: Command failed: ERROR: no dump file specified
)


Process finished with exit code 1

#appium 报错

> Starting Node Server
> info: Welcome to Appium v1.3.4 (REV c8c79a85fbd6870cd6fc3d66d038a115ebe22efe)
> info: Appium REST http interface listener started on 127.0.0.1:4723
> info: [debug] Non-default server args: {"address":"127.0.0.1","logNoColors":true,"platformName":"Android","platformVersion":"18","automationName":"Selendroid"}
> info: Console LogLevel: debug
> info: --> POST /wd/hub/session {"desiredCapabilities":{"deviceName":"192.168.56.101:5555","automationName":"Selendroid","platformVersion":"4.1","appPackage":"com.tongbanjie.android","platformName":"Android","appActivity":".TBJMainFragmentActivity"}}
> info: Client User-Agent string: Python-urllib/2.7
> info: [debug] Didn't get app but did get Android package, will attempt to launch it on the device
> info: [debug] Creating new appium session b60083a8-db6d-4ea1-9938-0f479c4af171
> info: [debug] Starting selendroid server
> info: [debug] Getting Java version
> info: Java version is: 1.6.0_43
> info: [debug] Checking whether selendroid is built yet
> info: [debug] Selendroid server exists!
> info: [debug] Using fast reset? true
> info: [debug] Preparing device for session
> info: [debug] Not checking whether app is present since we are assuming it's already on the device
> info: [debug] Checking whether adb is present
> info: [debug] Using adb from D:\mobiletest\android-sdk\platform-tools\adb.exe
> info: Retrieving device
> info: [debug] Trying to find a connected android device
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: D:\mobiletest\android-sdk\platform-tools\adb.exe devices
> info: [debug] 1 device(s) connected
> info: Found device 192.168.56.101:5555
> info: [debug] Setting device id to 192.168.56.101:5555
> info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
> info: [debug] executing cmd: D:\mobiletest\android-sdk\platform-tools\adb.exe -s 192.168.56.101:5555 wait-for-device
> info: [debug] executing cmd: D:\mobiletest\android-sdk\platform-tools\adb.exe -s 192.168.56.101:5555 shell "echo 'ready'"
> info: [debug] Starting logcat capture
> info: [debug] Checking whether aapt is present
> info: [debug] Using aapt from D:\mobiletest\android-sdk\build-tools\18.0.0\aapt.exe
> info: [debug] Checking if has internet permission from manifest.
> info: [debug] executing cmd: D:\mobiletest\android-sdk\build-tools\18.0.0\aapt.exe dump badging 
> warn: ERROR: no dump file specified
> 
> error: Failed to start an Appium session, err was: Error: hasInternetPermissionFromManifest failed. Error: Command failed: ERROR: no dump file specified
> 
> info: [debug] Cleaning up appium session
> info: [debug] Error: hasInternetPermissionFromManifest failed. Error: Command failed: ERROR: no dump file specified
> 
>     at D:\AppiumForWindows-1.3.4.1\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1648:19
>     at ChildProcess.exithandler (child_process.js:641:7)
>     at ChildProcess.EventEmitter.emit (events.js:98:17)
>     at maybeClose (child_process.js:743:16)
>     at Process.ChildProcess._handle.onexit (child_process.js:810:5)
> info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: hasInternetPermissionFromManifest failed. Error: Command failed: ERROR: no dump file specified\r\n)","origValue":"hasInternetPermissionFromManifest failed. Error: Command failed: ERROR: no dump file specified\r\n"},"sessionId":null}
> info: <-- POST /wd/hub/session 500 2743.481 ms - 318 
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 11 条回复 时间 点赞

http://appium.io/slate/en/master/

Selendroid requires the following permission for your app:
<uses-permission android:name="android.**permission.INTERNET”/>
, please make sure your app has internet permission set when you are using selendroid or older versions of Android i.e. 2.3 to 4.1

selendroid 要重签名,加上 desired_caps['app’] ,或者自己签 debug key 。

#2 · July 02, 2015 Author

#1 楼 @sanlengjingvv 好的,我明天试试

#3 · July 03, 2015 Author

#1 楼 @sanlengjingvv 加这个 app 的配置貌似就是每次都要重新安装了啊

#3 楼 @mads 重新安装的时候进行的重签名吧,你打开应用后能识别到控件吗?我应用打开识别不了控件

selendroid 的东西建议还是去看 selendroid 官方的文档,appium 在这方面只是把 selendroid 包了进来,然后所有请求都直接转发给 selendroid server 。
Selendroid 自己的文档还是不少的,只是坑略多。

http://selendroid.testerhome.com/ 我最近在写的.
@chenhengjie123 帮忙来提交啊~

#6 楼 @lihuazhang 行啊,你完整目录结构怎样的?我看下哪方面我比较熟悉可以写下。

#7 楼 @chenhengjie123 目录结构 还没有 我写完一章 想下一章 主要是遵循我前面培训时候的思路。

#3 楼 @mads
不加,手机上安装重签过的 app

#10 · July 03, 2015 Author

#9 楼 @sanlengjingvv 你的意思是加了这个 app 的配置之后,我就第一次是需要安装这个 app?第二三次,这个配置还存在,也不会安装了?还是第一次配置这个 app 就可以了。之后的过程都可以注释掉?

#10 楼 @mads 实践出真知,你试一下嘛。

需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up