Appium Appium python 客户端启动时间太长

jsplyy · April 19, 2018 · Last by jushual replied at July 18, 2018 · 2537 hits
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = config.ANDROID_VERSION
desired_caps['deviceName'] = 'Android Emulator'
desired_caps['app'] = 'C://FangCloudV2/nxp\code/ble_app_test/app_test/IoT_Toolbox-5.0.2.apk'
desired_caps['appPackage'] = 'com.freescale.kinetisbletoolbox'
desired_caps['appActivity'] = 'com.freescale.bletoolbox.activity.CheckActivity'
desired_caps['autoGrantPermissions'] = True
desired_caps['autoAcceptAlerts'] = True


self.driver = webdriver.Remote('http://' + config.addressOfAppiumServer + ':' + config.portOfAppiumServer +'/wd/hub', desire
self.driver = webdriver.Remote('http://' + config.addressOfAppiumServer + ':' + config.portOfAppiumServer +'/wd/hub', desired_caps)

这一行代码执行了25s,正常吗,感觉太慢了,如何加速?

共收到 5 条回复 时间 点赞

不正常

楼主,我遇到过跟你一样的问题,就前段时间的时候,我的是1分多钟,我后面就尝试换了台测试设备,并且修改capabilities参数重新跑脚本,就快多了。暂时猜测是和设备有关系。如果楼主有其他新的看法了欢迎交流呀~

[Appium] Welcome to Appium v1.7.2
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session {"capabilities":{"alwaysMatch":{"platformName":"Android"},"firstMatch":[{}]},"desiredCapabilities":{"platformVersion":"8.0","deviceName":"PL2GAM1810800834","platformName":"Android","appActivity":".Calculator","appPackage":"com.android.calculator2"}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"platformVersion":"8.0","deviceName":"PL2GAM1810800834","platformName":"Android","appActivity":".Calculator","appPackage":"com.android.calculator2"},null,{"alwaysMatch":{"platformName":"Android"},"firstMatch":[{}]}]
[BaseDriver] Event 'newSessionRequested' logged at 1524388401480 (17:13:21 GMT+0800 (中国标准时间))
[Appium] Merged W3C capabilities {"alwaysMatch":{"platformName":"Android"},"firs... into desiredCapabilities object {"platformVersion":"8.0","deviceName":"PL2GAM18...
[Appium] Creating new AndroidDriver (v1.37.0) session
[Appium] Capabilities:
[Appium] platformVersion: 8.0
[Appium] deviceName: PL2GAM1810800834
[Appium] platformName: Android
[Appium] appActivity: .Calculator
[Appium] appPackage: com.android.calculator2
[BaseDriver] Session created with session id: fd067d70-061c-4e3f-9f23-280c9c8f8c19
[AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_161
[ADB] Checking whether adb is present
[AndroidDriver] Shutting down Android driver
[AndroidDriver] Called deleteSession but bootstrap wasn't active
[MJSONWP] Encountered internal error running command: TypeError: Invalid Version: lib
at new SemVer (C:\Users\Administrator\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\semver\semver.js:293:11)
at compare (C:\Users\Administrator\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\semver\semver.js:566:10)
at rcompare (C:\Users\Administrator\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\semver\semver.js:576:10)
at Array.sort (native)
at Array.sort (C:\Users\Administrator\AppData\Local\Programs\appium-desktop\resources\app\webpack:~\core-js\modules\es6.array.sort.js:21:1)
at ADB.callee$0$0$ (C:\Users\Administrator\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\system-calls.js:89:17)
at tryCatch (C:\Users\Administrator\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as next
at GeneratorFunctionPrototype.invoke (C:\Users\Administrator\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
at
[HTTP] <-- POST /wd/hub/session 500 147 ms - 157

麻烦大神帮我看看这个是什么问题?Appium的log

======================================================================
ERROR: test_single_player_mode (main.ChessAndroidTests)

Test the Chess app launches correctly and click on Play button

Traceback (most recent call last):
File "C:\Python27\333.py", line 19, in setUp
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
File "C:\Python27\lib\site-packages\appium\webdriver\webdriver.py", line 36, 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 154, in init
self.start_session(desired_capabilities, browser_profile)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 243, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Invalid Version: lib


Ran 1 test in 0.230s

FAILED (errors=1)
这个是python的报错log

我也出现了这种问题,如果想等待所有权限同意完成, 用什么来判断比较合适呢
我设定了sleep(20)但还是不能保证

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