GithubHelp home page GithubHelp logo

Weird error received about pageres HOT 6 CLOSED

DNAScanner avatar DNAScanner commented on June 2, 2024
Weird error received

from pageres.

Comments (6)

Summaw avatar Summaw commented on June 2, 2024

Hello there, Can you upload some of your code? I might be able to see if your missing something... or you can try adding this with headless: false mode:
browser.on('targetcreated', async target => { if (target.type() === 'page') { const page = await target.page() await page.target().createCDPSession() } })

from pageres.

DNAScanner avatar DNAScanner commented on June 2, 2024

This is my code. It worked until a few days

await new Pageres({delay: 3, script: `./web_scripts/google_translate/run.js`})
			.source(translationUrl, ["1920x1080"], {filename: `${imageId}`, selector: `body > c-wiz:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(2) > c-wiz:nth-of-type(1) > div:nth-of-type(2) > c-wiz:nth-of-type(1) > div:nth-of-type(1)`})
			.destination("./images/")
			.run();

from pageres.

Summaw avatar Summaw commented on June 2, 2024

You could try waiting for the selector to appear. Like set a timeout before continuing

from pageres.

DNAScanner avatar DNAScanner commented on June 2, 2024

Do you mean delay?

from pageres.

Summaw avatar Summaw commented on June 2, 2024

So no, you already have a delay of 3 seconds there... what im saying is have puppeteer wait for the selector maybe something like
page.waitForSelector('body > c-wiz:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(2) > c-wiz:nth-of-type(1) > div:nth-of-type(2) > c-wiz:nth-of-type(1) > div:nth-of-type(1)', {timeout: 10 * 1000})`

so instead of what your doing try something like this:
await new Pageres({
delay: 3,
beforeScreenshot: async (page, browser) => {
await checkSomething();
await page.waitForSelector('body > c-wiz:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(2) > c-wiz:nth-of-type(1) > div:nth-of-type(2) > c-wiz:nth-of-type(1) > div:nth-of-type(1)', {timeout: 10 * 1000})
await page.click('do something with that selector or any other selector'); // you might not need this.
}
})
.source(translationUrl, ["1920x1080"],{filename: ${imageId}})
.destination('./images/')
.run();

console.log('finished so and so');

from pageres.

DNAScanner avatar DNAScanner commented on June 2, 2024

Plottwist, google just did some stuff i didnt like so that was the actual reason, why that stuff didn't work. Thanks anyways

from pageres.

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.