Преглед на файлове

add more cases to trigger page reload

Mike L преди 3 години
родител
ревизия
9d6f96535f
променени са 2 файла, в които са добавени 4 реда и са изтрити 0 реда
  1. 2 0
      dist/webshot.js
  2. 2 0
      src/webshot.ts

+ 2 - 0
dist/webshot.js

@@ -86,6 +86,8 @@ class Webshot extends CallableInstance {
                         .then(() => Promise.race([
                         page.waitForSelector('article', { state: 'attached', timeout: getTimeout() }),
                         page.click('#placeholder+#ScriptLoadFailure input[value="Try again"]', { timeout: getTimeout() }),
+                        page.waitForSelector('div[role="button"]>div>span>:text-matches("^やりなおす|更新$")', { state: 'attached', timeout: getTimeout() })
+                            .then(() => page.reload({ timeout: getTimeout() })),
                     ]))
                         .then(() => page.addStyleTag({
                         content: 'header,#layers{display:none!important}article{background-color:transparent!important}' +

+ 2 - 0
src/webshot.ts

@@ -112,6 +112,8 @@ class Webshot extends CallableInstance<[Tweets, (...args) => void, number], Prom
             .then(() => Promise.race([
               page.waitForSelector('article', {state: 'attached', timeout: getTimeout()}),
               page.click('#placeholder+#ScriptLoadFailure input[value="Try again"]', {timeout: getTimeout()}),
+              page.waitForSelector('div[role="button"]>div>span>:text-matches("^やりなおす|更新$")', {state: 'attached', timeout: getTimeout()})
+                .then(() => page.reload({timeout: getTimeout()})),
             ]))
             // hide header, "more options" button, like and retweet count
             .then(() => page.addStyleTag({