You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 3, 2024. It is now read-only.
// Current situation:awaittab.wait(async()=>{awaitwait.documentComplete().selectorAll('.gallery > img').count(10,Infinity).isDisplayed()link=awaitwait.selector('a[href].nextPage')})// this will error because the script is aborted by the page navigationawaittab.run(async()=>{awaitinteract.click(link)});// This is the correct version:awaittab.waitForNewPage(async()=>{awaitinteract.click(link)});
We could make this a lot less verbose by giving the scripter more control over the behaviour of these functions, from within the content script. For example:
awaittab.wait(async()=>{awaitwait.documentComplete().selectorAll('.gallery > img').count(10,Infinity).isDisplayed()constlink=awaitwait.selector('a[href].nextPage')// triggers the same behaviour as tab.waitForNewPage()awaitthis.expectNewPage()awaitinteract.click(link)})// full usage exampleawaittab.wait(async()=>{// .result(): sets the result of the outer promise. Also, the .wait() callback body // will not repeat for the next page. However the outer promise will still wait// until the callback body completes, or the page navigates awayawaitthis.result(123)// .reject(): same as result() but rejects instead of resolve .error(Error('foo'))// triggers the same behaviour as tab.waitForNewPage() and it also // implies .result(undefined) if no result had been set.expectNewPage()// the `runMetadata` global can then be renamed to `this.meta`console.log(newDate(this.meta.waitBeginTime));})