Code Monkey home page Code Monkey logo

Comments (16)

zfcsoftware avatar zfcsoftware commented on August 25, 2024 1

This was closed but it also doesnt work for me

I even tried using that script exactly it screenshotted the page but no directories were created.

Please try this.


const fs = require('fs');
const path = require('path');

function createDirectoryIfNotExists(dirPath) {
    if (!fs.existsSync(dirPath)) {
        fs.mkdirSync(dirPath, { recursive: true });
    }
}

async function test() {
    const { connect } = await import('puppeteer-real-browser');
    createDirectoryIfNotExists(path.join(__dirname, 'zfc'));
    connect({

        customConfig: {
            userDataDir: './zfc',
        },
    })
        .then(async response => {
            const { browser, page } = response


            await page.goto('https://google.com')
            setInterval(() => {
                page.screenshot({ path: 'example.png' }).catch(error => { console.log(error.message) })
            }, 1000);
        })
        .catch(error => {
            console.log(error.message)
        })
}

test()

image

from puppeteer-real-browser.

zfcsoftware avatar zfcsoftware commented on August 25, 2024 1

The library has been updated. This problem should be solved. Can you try again now?

from puppeteer-real-browser.

xheatcodes avatar xheatcodes commented on August 25, 2024 1

It's working now, thanks

The library has been updated. This problem should be solved. Can you try again now?

from puppeteer-real-browser.

zfcsoftware avatar zfcsoftware commented on August 25, 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); 
    }
    })();

from puppeteer-real-browser.

MoonDoggie97 avatar MoonDoggie97 commented on August 25, 2024

This was closed but it also doesnt work for me

from puppeteer-real-browser.

MoonDoggie97 avatar MoonDoggie97 commented on August 25, 2024

I even tried using that script exactly it screenshotted the page but no directories were created.

from puppeteer-real-browser.

MoonAlt97 avatar MoonAlt97 commented on August 25, 2024

It changes nothing the path already existed. When used with customconfig the page just opens as about:blank and it won’t go to any pages I tried using your fix for that from another issue (set target) but it did nothing

from puppeteer-real-browser.

MoonDoggie97 avatar MoonDoggie97 commented on August 25, 2024

image
This is all that happens with your code it uses the directory but than it wont load any pages at all i copy pasted your code directly and made no change it created the directory opened chrome and than wouldnt go farther

from puppeteer-real-browser.

MoonDoggie97 avatar MoonDoggie97 commented on August 25, 2024

it also only puts three files in the directory the rest of the userdata like cookies etc isnt there.

from puppeteer-real-browser.

MoonDoggie97 avatar MoonDoggie97 commented on August 25, 2024

This doesnt work man im not trying to be rude but its an issue and you claim it works fine but me and others all have the same issue

from puppeteer-real-browser.

zfcsoftware avatar zfcsoftware commented on August 25, 2024

This doesnt work man im not trying to be rude but its an issue and you claim it works fine but me and others all have the same issue

This is an open source project. As the readme file says, you can't make aggressive and demanding requests like this. I'm running Ubuntu and I had no problems when I tested it. I'll start a windows virtual machine and test it when I can.

https://github.com/zfcsoftware/cf-clearance-scraper/blob/main/module/browser.js

You can try to open a browser and use it as in these codes. Please do not continue spamming.

2024-06-14.02-30-05.mp4

from puppeteer-real-browser.

MoonDoggie97 avatar MoonDoggie97 commented on August 25, 2024

Look man im not spamming im trying to make you aware that the issue isnt "Solved" its an ongoing issue, im also not demanding anything, my posts were unacknowledged so i was unsure if you were taking the issue as an actual issue or just thinking its user error, i am on windows though and maybe that is why it works for you but not me i will try the code in browser.js and i will also try on linux and let you know if it works fine there vs windows

from puppeteer-real-browser.

sharpanimes avatar sharpanimes commented on August 25, 2024

Use normal puppeter once to initialize the directory which you want, then switch to puppeter-real-browser. I think there is an issue with initializing the user directory in this real-browser. Also use the customconfig parameter to specify the directory.

from puppeteer-real-browser.

MoonAlt97 avatar MoonAlt97 commented on August 25, 2024

from puppeteer-real-browser.

xheatcodes avatar xheatcodes commented on August 25, 2024

Use normal puppeter once to initialize the directory which you want, then switch to puppeter-real-browser. I think there is an issue with initializing the user directory in this real-browser. Also use the customconfig parameter to specify the directory.

It doesn't work because I tested if I save the data to localStorage by running it through puppeteer or just opening it as # chrome.exe --user-data-dir=... , and then through puppeteer-real-browser, the data is not contained there, which means that puppeteer-real-browser uses a different directory

from puppeteer-real-browser.

xheatcodes avatar xheatcodes commented on August 25, 2024

It worked for me to specify the full path of the pre-created directory

customConfig: {
    userDataDir: full_path_created_directory,
}

P.S. The error on Windows is not in the puppeteer-real-browser module, but in the chrome-launcher module, the full path is not used there(for --user-data-directory argument), therefore a temporary directory of user data is created

from puppeteer-real-browser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.