fakebrowser icon indicating copy to clipboard operation
fakebrowser copied to clipboard

how to close default first tab?

Open cffgnu opened this issue 2 years ago • 6 comments

this library open 2 tab. tab 1: default , tab 2 by: await fakeBrowser.vanillaBrowser.newPage(). i want to remove default puppeteer tab. how to ?

cffgnu avatar Oct 21 '22 13:10 cffgnu

use this const page = (await fakeBrowser.vanillaBrowser.pages())[0] to select default page tab

6ebeng avatar Oct 21 '22 13:10 6ebeng

sory, it not working because (await fakeBrowser.vanillaBrowser.pages()).length return zero.

cffgnu avatar Oct 21 '22 13:10 cffgnu

then zero index is a first tab

6ebeng avatar Oct 21 '22 13:10 6ebeng

I'm using puppeteer have no issues

6ebeng avatar Oct 21 '22 13:10 6ebeng

my example code:

let fakeBrowser = await builder.launch();
var pages = await fakeBrowser.vanillaBrowser.pages();
console.log(pages.length==0); //true

Please explain?

cffgnu avatar Oct 21 '22 14:10 cffgnu

Can confirm. await fakeBrowser.vanillaBrowser.pages(); returns an empty array.

djengis avatar Dec 08 '22 10:12 djengis