1. <tfoot id='RRB2I'></tfoot>

        <bdo id='RRB2I'></bdo><ul id='RRB2I'></ul>

      <legend id='RRB2I'><style id='RRB2I'><dir id='RRB2I'><q id='RRB2I'></q></dir></style></legend>
    1. <i id='RRB2I'><tr id='RRB2I'><dt id='RRB2I'><q id='RRB2I'><span id='RRB2I'><b id='RRB2I'><form id='RRB2I'><ins id='RRB2I'></ins><ul id='RRB2I'></ul><sub id='RRB2I'></sub></form><legend id='RRB2I'></legend><bdo id='RRB2I'><pre id='RRB2I'><center id='RRB2I'></center></pre></bdo></b><th id='RRB2I'></th></span></q></dt></tr></i><div id='RRB2I'><tfoot id='RRB2I'></tfoot><dl id='RRB2I'><fieldset id='RRB2I'></fieldset></dl></div>

      <small id='RRB2I'></small><noframes id='RRB2I'>

      如何修复硒“DevToolsActivePort 文件不存在"Pyt

      时间:2023-10-08

          <legend id='XjR9R'><style id='XjR9R'><dir id='XjR9R'><q id='XjR9R'></q></dir></style></legend>
        • <small id='XjR9R'></small><noframes id='XjR9R'>

          <tfoot id='XjR9R'></tfoot>
            <tbody id='XjR9R'></tbody>
            <bdo id='XjR9R'></bdo><ul id='XjR9R'></ul>

              1. <i id='XjR9R'><tr id='XjR9R'><dt id='XjR9R'><q id='XjR9R'><span id='XjR9R'><b id='XjR9R'><form id='XjR9R'><ins id='XjR9R'></ins><ul id='XjR9R'></ul><sub id='XjR9R'></sub></form><legend id='XjR9R'></legend><bdo id='XjR9R'><pre id='XjR9R'><center id='XjR9R'></center></pre></bdo></b><th id='XjR9R'></th></span></q></dt></tr></i><div id='XjR9R'><tfoot id='XjR9R'></tfoot><dl id='XjR9R'><fieldset id='XjR9R'></fieldset></dl></div>
                本文介绍了如何修复硒“DevToolsActivePort 文件不存在"Python 中的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                当我同时使用参数 --headlessuser-data-dir 时.Selenium 引发 selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort 文件不存在 异常.如果只使用其中一个,那么一切都按需要进行.

                When I use both arguments --headless and user-data-dir. Selenium raise selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist exception. If only 1 of them is used, then everything works as needs.

                我尝试交换参数并删除其中一些.指定 chromedriver.exe 的完整路径.这些都没有帮助.

                I tried to swap arguments and remove some of them. Specified the full path to chromedriver.exe. None of this helped.

                chromeOptions.add_argument("--disable-dev-shm-using") 没有帮助.

                login = "test"
                chromeOptions = webdriver.ChromeOptions() 
                chromeOptions.add_experimental_option("prefs", {"profile.managed_default_content_settings.images": 2}) 
                chromeOptions.add_argument("--no-sandbox") 
                chromeOptions.add_argument("--disable-setuid-sandbox") 
                chromeOptions.add_argument("--disable-dev-shm-using") 
                chromeOptions.add_argument("--disable-extensions") 
                chromeOptions.add_argument("--disable-gpu") 
                chromeOptions.add_argument("start-maximized") 
                chromeOptions.add_argument("disable-infobars") 
                chromeOptions.add_argument("--headless") 
                chromeOptions.add_argument(r"user-data-dir=.cookies\" + login) 
                b = webdriver.Chrome(chrome_options=chromeOptions) 
                b.get("https://google.com/") 
                b.quit() 
                

                推荐答案

                我通过添加参数解决它 --remote-debugging-port=<port>

                I solve it by adding an argument --remote-debugging-port=<port>

                chromeOptions = webdriver.ChromeOptions() 
                chromeOptions.add_experimental_option("prefs", {"profile.managed_default_content_settings.images": 2}) 
                chromeOptions.add_argument("--no-sandbox") 
                chromeOptions.add_argument("--disable-setuid-sandbox") 
                
                chromeOptions.add_argument("--remote-debugging-port=9222")  # this
                
                chromeOptions.add_argument("--disable-dev-shm-using") 
                chromeOptions.add_argument("--disable-extensions") 
                chromeOptions.add_argument("--disable-gpu") 
                chromeOptions.add_argument("start-maximized") 
                chromeOptions.add_argument("disable-infobars")
                chromeOptions.add_argument(r"user-data-dir=.cookies\test") 
                
                b = webdriver.Chrome(chrome_options=chromeOptions) 
                b.get("https://google.com/") 
                b.quit()
                

                这篇关于如何修复硒“DevToolsActivePort 文件不存在"Python 中的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:python/selenium/chromedriver TimeoutException 下一篇:在 chromedriver 中使用 python 绑定为 selenium 设置 c

                相关文章

                最新文章

              2. <i id='xl3pT'><tr id='xl3pT'><dt id='xl3pT'><q id='xl3pT'><span id='xl3pT'><b id='xl3pT'><form id='xl3pT'><ins id='xl3pT'></ins><ul id='xl3pT'></ul><sub id='xl3pT'></sub></form><legend id='xl3pT'></legend><bdo id='xl3pT'><pre id='xl3pT'><center id='xl3pT'></center></pre></bdo></b><th id='xl3pT'></th></span></q></dt></tr></i><div id='xl3pT'><tfoot id='xl3pT'></tfoot><dl id='xl3pT'><fieldset id='xl3pT'></fieldset></dl></div>

                    <bdo id='xl3pT'></bdo><ul id='xl3pT'></ul>

                1. <tfoot id='xl3pT'></tfoot>
                2. <legend id='xl3pT'><style id='xl3pT'><dir id='xl3pT'><q id='xl3pT'></q></dir></style></legend>

                  <small id='xl3pT'></small><noframes id='xl3pT'>