答案是:
基于python中hide chromeDriver控制台中的chanticler
按如下方式定位和编辑此文件:位于Lib\site packages\selenium\webdriver\common\服务.py在Python文件夹中。在
通过以下方式添加创建标志来编辑Start()函数:creationflags=CREATE_NO_WINDOWfrom win32process import CREATE_NO_WINDOW
def start(self):
"""
Starts the Service.
:Exceptions:
- WebDriverException : Raised either when it can't start the service
or when it can't connect to the service
"""
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=CREATE_NO_WINDOW)
except TypeError:
raise
非常适合我(python3.7,selenium 3.141.0)
请相信我花了好几个小时寻找答案。在