Python3 Selenium ChromeDriver仅在Pyinstaller Windows 10中禁用扩展日志记录

Python3 Selenium ChromeDriver仅在Pyinstaller Windows 10中禁用扩展日志记录,python,selenium,pyinstaller,Python,Selenium,Pyinstaller,我使用的是Windows 10、Python 3.5.4、Windows Chrome驱动程序2.33、Selnium 3.6.0和Pyinstaller 3.3 我的Chrome驱动程序扩展生成控制台日志记录,这似乎是Chrome中的扩展导致的 (我尝试了chrome_选项。添加_参数(“--disable extensions”),但日志记录不明显) 我想使用Chrome扩展保持,但我只想禁用此日志记录。 在禁用此日志记录之前,我无法在没有控制台的情况下创建pyinstaller.exe 关

我使用的是Windows 10、Python 3.5.4、Windows Chrome驱动程序2.33、Selnium 3.6.0和Pyinstaller 3.3

我的Chrome驱动程序扩展生成控制台日志记录,这似乎是Chrome中的扩展导致的

(我尝试了chrome_选项。添加_参数(“--disable extensions”),但日志记录不明显)

我想使用Chrome扩展保持,但我只想禁用此日志记录。

在禁用此日志记录之前,我无法在没有控制台的情况下创建pyinstaller.exe

关于如何仅禁用selenium chrome驱动程序扩展日志的任何建议?或者在Python中使用pyinstaller创建没有控制台的exe

谢谢你抽出时间

# Python Script Parameters for chrome driver.

# example.py

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--disable-infobars")
chrome_options.add_argument("--disable-logging")
chrome_options.add_argument("--disable-notifications")
chrome_options.add_argument("--disable-default-apps")
chrome_options.add_argument('--user-data-dir=C:\\Users\\testuser\\AppData\\Local\\Google\\Chrome\\User Data')

driver = webdriver.Chrome(r"D:\Selenium\chromedriver_win32\chromedriver.exe", chrome_options=chrome_options)

如果要禁用控制台,应修改webdriver file service.py的源代码。文件路径示例
C:\Python27\Lib\site packages\selenium\webdriver\common\service.py
将第69行更改为该行

try:
        cmd = [self.path]
        cmd.extend(self.command_line_args())

        startupinfo = subprocess.STARTUPINFO()
        startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW

        self.process = subprocess.Popen(cmd, env=self.env, startupinfo=startupinfo,
                                        close_fds=platform.system() != 'Windows',
                                        stdout=self.log_file, stderr=self.log_file)
    except TypeError:
        raise

然后,当您构建应用程序并运行时,Chromedriver控制台将不会显示。

同样的问题。我还没有找到如何禁用它