Hey there,
I’m looking to create a new tab, then interact with the page once it’s completed loading. Currently I’m doing something like:
browser.tabs.create({url: url}).then( (newTabInfo) =>
@interactWithPage(newTabInfo)
but I got the error message in the debugger of “Error: Could not establish connection. Receiving end does not exist.”
I thought I needed to do something like create a listener to wait for the new tab to have the status of ‘complete’, but when I added that check inline it still passed:
browser.tabs.create({url: url}).then( (newTabInfo) =>
if newTabInfo.status == "complete"
@interactWithPage(newTabInfo)
else
console.log "page not loaded yet"
My guess is that the complete refers to the tab being successfully loaded, but I’m interested in whether or not the content of the page is loaded. Is there a way within the API to make that check, is there another technique that I can use to wait, or am I missing something really obvious? (or all of the above.)
Thanks!