python - Selenium Error: BadStatusLine -
hi new in selenium webdriver , creating test case specific function.
i have current test case working function, when include new test case , run it. receive error: badstatusline
.
also when run individual test case work fine, when run whole test receive error: badstatusline
.
error: test_task_xml (__main__.testactuserlayouts) test if task xml hidden ---------------------------------------------------------------------- traceback (most recent call last): file "acttemplate_layouts.py", line 25, in setup driver.find_element_by_name("password").submit() file "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 84, in submit self._execute(command.submit_element) file "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 457, in _execute return self._parent.execute(command, params) file "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 231, in execute response = self.command_executor.execute(driver_command, params) file "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.py", line 395, in execute return self._request(command_info[0], url, body=data) file "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.py", line 426, in _request resp = self._conn.getresponse() file "/usr/lib/python2.7/httplib.py", line 1051, in getresponse response.begin() file "/usr/lib/python2.7/httplib.py", line 415, in begin version, status, reason = self._read_status() file "/usr/lib/python2.7/httplib.py", line 379, in _read_status raise badstatusline(line) badstatusline: ''
this whole test:
import unittest selenium import webdriver class testactuserlayouts(unittest.testcase): """test user functions """ driver = webdriver.firefox() driver.implicitly_wait(30) base_url = "http://samplepage.com" def setup(self): """base setting before test """ driver = self.driver # login driver.get(self.base_url + "/") driver.find_element_by_name("user_name").clear() driver.find_element_by_name("user_name").send_keys("userme") driver.find_element_by_name("password").clear() driver.find_element_by_name("password").send_keys("123") driver.find_element_by_name("password").submit() self.assertequal(self.base_url + "/userme/inbox/", driver.current_url) def test_task_xml(self): """test if task xml hidden """ driver = self.driver # page url driver.get(self.base_url + "/userme/mission/") # page url driver.get(self.base_url + "/mission/update/0000000a-0000-0000-0000-000000000000/") self.assertequal(self.base_url + "/mission/update/0000000a-0000-0000-0000-000000000000/", driver.current_url) driver.find_element_by_id("discussion-btn").click() # scan browser if task xml not present self.assertfalse('task xml' in self.driver.page_source) def test_task_list(self): """test if number of task each mission null """ driver = self.driver #get page url driver.get(self.base_url + "/userme/mission/") #get page url driver.get(self.base_url + "/acttemplate/list-all/") #scan browser if number of task null self.assertequal(driver.find_element_by_xpath("//tr[3]/td[4]").text != "", true) def teardown(self): """clear setting after test """ self.driver.close() # run unit test directly if __name__ == "__main__": unittest.main()
while other test case failure. so, not familiar selenium , need locate error. can please me in issue. lot.
i'm not sure, i'll make guess. somehow, browser dies while perform such actions pressing buttons, clicking.
it's error raised httplib (low-level python http library), means server inside browser didn't responded of known http status codes (200, 300, 500, etc.), , instead, response '' (empty string).