标题: python+appium+unittest执行脚本时不执行的问题? [打印本页] 作者: bling123 时间: 2018-11-28 09:18 标题: python+appium+unittest执行脚本时不执行的问题? python+appium+unittest执行脚本时候,一直卡在这个地方,是什么原因啊,是脚本问题还是什么原因? appium中:
> error: Unhandled error: TypeError: undefined is not a function
> at [object Object].ADB.getPIDsByName (D:\Appium\loadspace\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1037:8)
> at [object Object].ADB.killProcessesByName (D:\Appium\loadspace\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1079:8)
> at [object Object].UiAutomator.start (D:\Appium\loadspace\Appium\node_modules\appium\lib\devices\android\uiautomator.js:29:12)
> at [object Object].<anonymous> (D:\Appium\loadspace\Appium\node_modules\appium\lib\devices\android\android.js:115:37)
> at D:\Appium\loadspace\Appium\node_modules\appium\node_modules\async\lib\async.js:607:21
> at D:\Appium\loadspace\Appium\node_modules\appium\node_modules\async\lib\async.js:246:17
> at iterate (D:\Appium\loadspace\Appium\node_modules\appium\node_modules\async\lib\async.js:146:13)
> at D:\Appium\loadspace\Appium\node_modules\appium\node_modules\async\lib\async.js:157:25
> at D:\Appium\loadspace\Appium\node_modules\appium\node_modules\async\lib\async.js:248:21
> at D:\Appium\loadspace\Appium\node_modules\appium\node_modules\async\lib\async.js:612:34
> at [object Object].androidCommon.initUnicode (D:\Appium\loadspace\Appium\node_modules\appium\lib\devices\android\android-common.js:878:5)
> at D:\Appium\loadspace\Appium\node_modules\appium\node_modules\async\lib\async.js:607:21
> at D:\Appium\loadspace\Appium\node_modules\appium\node_modules\async\lib\async.js:246:17
> at iterate (D:\Appium\loadspace\Appium\node_modules\appium\node_modules\async\lib\async.js:146:13)
> at D:\Appium\loadspace\Appium\node_modules\appium\node_modules\async\lib\async.js:157:25
> at D:\Appium\loadspace\Appium\node_modules\appium\node_modules\async\lib\async.js:248:21
> at D:\Appium\loadspace\Appium\node_modules\appium\node_modules\async\lib\async.js:612:34
> at [object Object].<anonymous> (D:\Appium\loadspace\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:180:9)
> at ChildProcess.exithandler (child_process.js:742:7)
> at ChildProcess.emit (events.js:110:17)
> at maybeClose (child_process.js:1016:16)
> at Process.ChildProcess._handle.onexit (child_process.js:1088:5) context: [POST /wd/hub/session {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android","appium:platformVersion":"7.0","appium:deviceName":"0123456789ABCDEF:5037","appium:appPackage":"com.njzx.care","appium:appAct]
Test_report说: File "D:\python\lib\http\client.py", line 297, in begin version, status, reason = self._read_status() File "D:\python\lib\http\client.py", line 266, in _read_status raise RemoteDisconnected("Remote end closed connection without"urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
import unittest
import test_case1_njzx_login
from HTMLTestRunner import HTMLTestRunner
# 测试用例集合:
if __name__ == '__main__':
suite = unittest.TestSuite() # unittest模块中的TestSuite()创建一个对象接收testcase
suite.addTests(unittest.TestLoader().loadTestsFromNames(['test_case1_njzx_login.test_login']))
with open('D:/HTMLReport.html', 'wb') as f:# 模式wb
runner = HTMLTestRunner(stream=f,
title=' Test Report',
description='generated by HTMLTestRunner----黄亮.',
verbosity=2
)
runner.run(suite)