# -*- 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