如何隐藏控制台窗口?
我在gui应用程序中使用无头铬和硒来从一个网页中抓取数据。
启动应用程序时,打开控制台窗口,然后显示chromedriver日志。
启动应用程序时,是否可以隐藏控制台上的chromedriver登录?
操作系统:Windows10
Python:3.6.3 Selenium
3.8.0
chromedriver:2.33
Google Chrome canary
在Lib \ site-packages \ selenium \ webdriver \ common \ services.py文件中
在服务类
在func start中添加creationflags参数
try:
cmd = [self.path]
cmd.extend(self.command_line_args())
self.process = subprocess.Popen(cmd, env=self.env,
close_fds=platform.system() != 'Windows',
stdout=self.log_file,
stderr=self.log_file,
creationflags=0x08000000,
stdin=PIPE)
except TypeError: ...
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句