浏览器自动化技术问题(要恢复页面吗?Chrome未正确关闭)

前言:

制作抖音网页版挂人气刷弹幕的自动化程序时,经常需要要重启,自动关闭窗口句柄。

二次启动的时候老是出现这个问题,

谷歌chrome浏览器每次打开提示“要恢复页面吗”怎么办?

如下图所示:

于是乎开始解决。。。google

我在启动 Google Chrome 时尝试了几个命令行选项,但没有一个可以阻止消息显示。我试过的是:

  • –disable-restore-session-state
  • –disable-session-crashed-bubble
  • –隐身

尝试过 Chrome 中的一些设置,但没有一个(还)起作用。 –incognito 选项是可以的但是

(我不想在隐身模式下运行浏览器,因为需要使用到缓存)

【解决方案1】:

@chromium-browser --kiosk --disable-restore-session-state --disable-features=TranslateUI --disable-session-crashed-bubble www.google.com

【解决方案2】:

 

1、关闭谷歌浏览器

2、打开 C:Users电脑用户名AppDataLocalGoogleChromeUser DataDefault 文件夹中的 Preferences 文件

3、查找exit_type,将”exit_type”:“crash” 改为”Normal”

"exit_type":"Crashed",
"exited_cleanly":false,
"exit_type":"None",
"exited_cleanly":true,

 

4、将Preferences 改为“只读”

在这里插入图片描述

 

【解决方案3】:

chromium-browser --disable --disable-translate --disable-infobars --disable-suggestions-service --disable-save-password-bubble --start-maximized  --noerrdialogs --disable-component-update --kiosk --incognito www.google.com

 

赞 (16)