大家好!遇到一个问题,希望大家能指点一下。我搭建好了 Appium 测试 Android 应用的测试环境,在运行 Python 编写的测试用例时,发现调用 Webdriver.remote 后,没有任何回应,Appium 的 log 如下:
info: Welcome to Appium v0.15.0 (REV a7b47d73a27074cc928cc5b325e5d4de1b6e5594)
info: Appium REST http interface listener started on 127.0.0.1:4723
info - socket.io started
debug: Appium request initiated at /wd/hub/session
debug: Request received with params: {"sessionId":null,"desiredCapabilities":{"a
pp-package":"lana.test.hellolana","app":"F:\workspace\HelloLana\bin\HelloLan
a.apk","browserName":"","version":"4.2","device":"Android","app-activity":"lana.
test.hellolana.HelloLanaActivity"}}
info: Using local app from desiredCaps: F:\workspace\HelloLana\bin\HelloLana.apk
info: Creating new appium session 93723c5f-066c-4923-9536-ab582746d37d
info: Starting android appium
debug: Using fast reset? false
info: Preparing device for session
info: Checking whether app is actually present
info: Checking whether adb is present
然后过了十几分钟后,Appium 的 log 打印出:POST /wd/hub/session 200 600810ms
测试用例代码抛出如下异常:
Traceback (most recent call last):
File "F:\Appium\sample-code\examples\python\android_lana0319.py", line 22, in
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 71, in init
self.start_session(desired_capabilities, browser_profile)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 162, in execute
response = self.command_executor.execute(driver_command, params)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 349, in execute
return self._request(command_info[0], url, body=data)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 417, in _request
resp = opener.open(request)
File "C:\Python27\lib\urllib2.py", line 394, in open
response = self._open(req, data)
File "C:\Python27\lib\urllib2.py", line 412, in _open
'_open', req)
File "C:\Python27\lib\urllib2.py", line 372, in _call_chain
result = func(*args)
File "C:\Python27\lib\urllib2.py", line 1199, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "C:\Python27\lib\urllib2.py", line 1170, in do_open
r = h.getresponse(buffering=True)
File "C:\Python27\lib\httplib.py", line 1027, in getresponse
response.begin()
File "C:\Python27\lib\httplib.py", line 407, in begin
version, status, reason = self._read_status()
File "C:\Python27\lib\httplib.py", line 371, in _read_status
raise BadStatusLine(line)
BadStatusLine: ''
环境配置和代码参数都多次检查过了,但是始终没有找到问题原因。希望大家能帮忙看看,万分谢谢!