测试代码
alert(1);
setTimeout(function(){
window.location.href = "http://www.douban.com";
alert(2);
setTimeout(function(){
console.log(1111);
window.location.href = "http://www.baidu.com";
alert(3);
}, 5000);
}, 5000);
执行之后,会发现,在 alert 2 之后,代码不再执行。
说明,跳转之后,Snippets 被终止运行。
所以,想实现多页面的自动化执行逻辑,用 Chrome Snippets 是不可能实现的。
继续尝试 Chrome TamperMonkey 插件。