51Testing软件测试论坛

标题: 关于Python+Selenium打不开浏览器的问题 [打印本页]

作者: 测试积点老人    时间: 2022-3-15 10:39
标题: 关于Python+Selenium打不开浏览器的问题
如题,每次运行用例就会报错,然后出来一个Firefox没有网址的空白网页,环境配置和驱动在另一台电脑上都没问题,求各位帮忙解答一下,谢谢!
  1. test_Monitor_Today.py::TestCase::test11_details FAILED
  2. testcase\test_Monitor_Today.py:154 (TestCase.test11_details)
  3. self = <testcase.test_Monitor_Today.TestCase testMethod=test11_details>
复制代码
  1. @allure.feature("排放口监测台账小结详情")
  2. def test11_details(self):
  3.     RecordLog().get_log().info("排放口监测台账小结详情-开始运行")
复制代码
  1.   acc = Test_accountMonitorSummary()
复制代码
  1. test_Monitor_Today.py:158:

  2. ..\base\base_page.py:17: in init
  3. self.driver = webdriver.Firefox()
  4. G:\Python3.8\lib\site-packages\selenium\webdriver\firefox\webdriver.py:76: in init
  5. command_executor=ExtensionConnection("127.0.0.1", self.profile,
  6. G:\Python3.8\lib\site-packages\selenium\webdriver\firefox\extension_connection.py:49: in init
  7. self.binary.launch_browser(self.profile)
  8. G:\Python3.8\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py:68: in launch_browser
  9. self._wait_until_connectable()

  10. self = <selenium.webdriver.firefox.firefox_binary.FirefoxBinary object at 0x0000000003E46DF0>
复制代码
  1. def _wait_until_connectable(self):
  2.     """Blocks until the extension is connectable in the firefox."""
  3.     count = 0
  4.     while not utils.is_connectable(self.profile.port):
  5.         if self.process.poll() is not None:
  6.             # Browser has exited
复制代码
  1.           raise WebDriverException("The browser appears to have exited "
  2.                   "before we could connect. If you specified a log_file in "
  3.                   "the FirefoxBinary constructor, check it for details.")
复制代码
  1. E selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.
复制代码
  1. G:\Python3.8\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py:98: WebDriverException

  2. ======================== 1 failed, 1 warning in 1.33s =========================

  3. Process finished with exit code 1
复制代码



作者: qqq911    时间: 2022-3-16 10:08
检查下环境
作者: jingzizx    时间: 2022-3-16 13:10
感觉不匹配




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2