测试积点老人 发表于 2022-3-15 10:39:16

关于Python+Selenium打不开浏览器的问题

如题,每次运行用例就会报错,然后出来一个Firefox没有网址的空白网页,环境配置和驱动在另一台电脑上都没问题,求各位帮忙解答一下,谢谢!
test_Monitor_Today.py::TestCase::test11_details FAILED
testcase\test_Monitor_Today.py:154 (TestCase.test11_details)
self = <testcase.test_Monitor_Today.TestCase testMethod=test11_details>@allure.feature("排放口监测台账小结详情")
def test11_details(self):
    RecordLog().get_log().info("排放口监测台账小结详情-开始运行")acc = Test_accountMonitorSummary()
test_Monitor_Today.py:158:

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

self = <selenium.webdriver.firefox.firefox_binary.FirefoxBinary object at 0x0000000003E46DF0>def _wait_until_connectable(self):
    """Blocks until the extension is connectable in the firefox."""
    count = 0
    while not utils.is_connectable(self.profile.port):
      if self.process.poll() is not None:
            # Browser has exited          raise WebDriverException("The browser appears to have exited "
                  "before we could connect. If you specified a log_file in "
                  "the FirefoxBinary constructor, check it for details.")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.G:\Python3.8\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py:98: WebDriverException

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

Process finished with exit code 1

qqq911 发表于 2022-3-16 10:08:13

检查下环境

jingzizx 发表于 2022-3-16 13:10:43

感觉不匹配
页: [1]
查看完整版本: 关于Python+Selenium打不开浏览器的问题