spyBrowser.events.on("scriptLoadComplete", async function () {
var comments = await spyBrowser.session.getCommentsAsync();
comments = comments.split(/\r|\n/);
var arr = [];
for (var i = 0; i < comments.length; i++) {
var line = comments[i].trim();
if (line.length == 0) continue;
arr.push(line);
}
if (arr.length == 0) {
spyBrowser.script.exit();
return;
}
var adr = arr.shift();
comments = arr.join("\r\n");
await spyBrowser.session.setCommentsAsync(comments);
spyBrowser.window.open(adr, false, false);
});
spyBrowser.events.on("mainWindowLoadComplete", async function () {
await spyBrowser.script.sleepAsync(3000); // В скобках размер задержки в миллисекундах
spyBrowser.events.emit("scriptLoadComplete");
});
spyBrowser.events.on("mainWindowLoadError", async function () {
await spyBrowser.script.sleepAsync(3000);
window.location.reload();
});