绍伟145 2022-03-14 18:21 采纳率: 25%
浏览 41

关于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

  • 写回答

1条回答 默认 最新

  • 陈年椰子 2022-03-16 16:48
    关注

    有没有可能是 driver 和 firefox 版本不匹配的问题?

    评论

报告相同问题?

问题事件

  • 创建了问题 3月14日

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试