Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom User data directory #46

Closed
PhucDao-PLab opened this issue May 6, 2024 · 1 comment
Closed

Custom User data directory #46

PhucDao-PLab opened this issue May 6, 2024 · 1 comment

Comments

@PhucDao-PLab
Copy link

PhucDao-PLab commented May 6, 2024

Hi everyone!
I try to use puppeteer with existing browser, but my profile does not load properly!
Here is my code

const { page, browser } = await connect({
executablePath: "D:\GPMLogin\gpm_browser\gpm_browser_chromium_core_119\chrome.exe",
headless: 'false',
args: [
'--user-data-dir=D:\GPM\9eea9e17-d2e9-400a-bd0f-249c49a0a7b4-3624',
'--window-size=640,640',
],
customConfig: {},
skipTarget: [],
fingerprint: true,
turnstile: true,
connectOption: {}
})

Thank you so much!

@zfcsoftware
Copy link
Owner

zfcsoftware commented May 7, 2024

Hello, there doesn't seem to be a problem. Could you have entered the wrong directory? Can you try / instead of ?

2024-05-07.13-07-53.mp4

(async () => {
    var { connect } = await import('puppeteer-real-browser')
    const { page, browser } = await connect({
    headless: 'auto',
    args: [
        `--user-data-dir=${__dirname}/9eea9e17-d2e9-400a-bd0f-249c49a0a7b4-3624`,
    ],
    customConfig: {},
    skipTarget: [],
    fingerprint: false,
    turnstile: true,
    connectOption: {},
    fpconfig: {},
    })
    
    try {
        setInterval(() => {
            page.screenshot({ path: 'screenshot.png' });
        }, 1000);
        await page.goto('https://jobnib.com/book/i-am-the-luna-chapter-32');
        console.log('OK');
        await page.waitForTimeout(30000);
    
    } catch (error) {
        console.error('Lỗi:', error);
    } finally {
        // await browser.close();
        // pool.end();
        // process.exit(1); 
    }
    })();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants