LucianoGanga/simple-headless-chrome

clearCookie Before goTo

Closed this issue · 1 comments

How can i clear all cookie?
Is there any function like clearCookies?

Hi @Jehanramadhan ! Sorry for the late reply. I had 2 surgeries in the past month and couldn't make time to answer the issues.

I've just added that fn to this module and it's available in v4.3.4, you just can use that by calling

const HeadlessChrome = require('../index')

const browser = new HeadlessChrome({
  headless: true
})
async function navigateWebsite () {
  try {
    await browser.init()
    const mainTab = await browser.newTab({
      privateTab: false
    })
    await mainTab.goTo('https://github.com/LucianoGanga/simple-headless-chrome')
    await mainTab.clearBrowserCookies()
    await browser.close()
  } catch (err) {
    console.log('ERROR!', err)
  }
}
navigateWebsite()

Cheers!
And again, sorry for the late reply