python3使用pyinstaller打包webdriver爬虫时,chromedriver弹窗DOS黑窗口解决方法

关闭driverchrome 监听,使用开发者模式

在driverchrome的option添加参数可开启开发者模式,关闭对网页的监听

chrome_options.add_experimental_option('excludeSwitches', ['enable-logging']) #开启开发者模式

处理打包成exe问题时出现chromedriver的DOS窗口问题

更改一个变量值:

位置 \venv\Lib\site-packages\selenium\webdriver\common
找到_ services.py
  然后找到start(),如下图,添加配置参数 creationflags=134217728 即可
Line:75 or 76:添加如下
python3使用pyinstaller打包webdriver爬虫时,chromedriver弹窗DOS黑窗口解决方法_第1张图片
stderr=self.log_file,
stdin=PIPE,creationflags=134217728)

你可能感兴趣的:(python3使用pyinstaller打包webdriver爬虫时,chromedriver弹窗DOS黑窗口解决方法)