1. 程式人生 > >初學appium,執行時總提示 ProtocolError: ('Connection aborted.', BadStatusLine("''",))

初學appium,執行時總提示 ProtocolError: ('Connection aborted.', BadStatusLine("''",))

Traceback (most recent call last):
  File "E:/About_stu/appium_WeChat.py", line 14, in <module>
    driver=webdriver.Remote("http://127.0.0.1:4723/wd/hub",desired_caps)
  File "D:\Program Files\Python27\lib\site-packages\selenium-3.14.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "D:\Program Files\Python27\lib\site-packages\selenium-3.14.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "D:\Program Files\Python27\lib\site-packages\selenium-3.14.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 319, in execute
    response = self.command_executor.execute(driver_command, params)
  File "D:\Program Files\Python27\lib\site-packages\selenium-3.14.1-py2.7.egg\selenium\webdriver\remote\remote_connection.py", line 376, in execute
    return self._request(command_info[0], url, body=data)
  File "D:\Program Files\Python27\lib\site-packages\selenium-3.14.1-py2.7.egg\selenium\webdriver\remote\remote_connection.py", line 404, in _request
    resp = http.request(method, url, body=body, headers=headers)
  File "D:\Program Files\Python27\lib\site-packages\urllib3\request.py", line 72, in request
    **urlopen_kw)
  File "D:\Program Files\Python27\lib\site-packages\urllib3\request.py", line 150, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "D:\Program Files\Python27\lib\site-packages\urllib3\poolmanager.py", line 323, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "D:\Program Files\Python27\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "D:\Program Files\Python27\lib\site-packages\urllib3\util\retry.py", line 367, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "D:\Program Files\Python27\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "D:\Program Files\Python27\lib\site-packages\urllib3\connectionpool.py", line 377, in _make_request
    httplib_response = conn.getresponse(buffering=True)
  File "D:\Program Files\Python27\lib\httplib.py", line 1121, in getresponse
    response.begin()
  File "D:\Program Files\Python27\lib\httplib.py", line 438, in begin
    version, status, reason = self._read_status()
  File "D:\Program Files\Python27\lib\httplib.py", line 402, in _read_status
    raise BadStatusLine(line)
ProtocolError: ('Connection aborted.', BadStatusLine("''",))

分析方法: 百度查了很多資料說是Http,嘗試了很多解決方案依然沒有解決(也許是我操作方式有問題) 解決方法: 最後發現是因為電腦沒有連線wifi(留給自己以後參考)