在django开发服务器上打开页面时出现状态行异常

Dan*_*nia 10 python testing django selenium

我正在通过Proboscis执行硒测试案例,以便很好地报告测试结果.我写了以下测试用例

from selenium import webdriver 
from selenium.webdriver.common.keys import Keys
from proboscis import test
import unittest
driver = webdriver.Firefox()

@test(groups=["unit","login"])
class UI_test(unittest.TestCase):

    def test_SuccessfulErrorMsgOnEmptyUserName(self):
        driver.get("http://127.0.0.1:7999/login/")
        username_input = driver.find_element_by_id("id_email")
        username_input.send_keys('')
        password_input = driver.find_element_by_id("id_password")
        password_input.send_keys('bill3')
        driver.find_element_by_xpath('//input[@value = "Log In"]').click()
        driver.implicitly_wait(3)
        driver.find_element_by_class_name("error-login")

driver.close()  

def run_tests():
    from proboscis import TestProgram
   # from tests import unit

    # Run Proboscis and exit.
    TestProgram().run_and_exit()

if __name__ == '__main__':
    run_tests() 
Run Code Online (Sandbox Code Playgroud)

什么可能导致BadStatusLine此代码中的异常?

Cee*_*man 3

看起来像Python/Django“BadStatusLine”错误的重复,但由于这个问题有赏金,我无法标记。根据这个答案BadStatusLine异常可能是由空响应引起的,因为根本没有状态行。

根据这个答案,服务器正式告诉客户端没有更多数据,而不是简单地导致连接重置或粗鲁超时。