Git Product home page Git Product logo

Comments (5)

sindresorhus avatar sindresorhus commented on August 18, 2024

Can you try the delay option? Set it to 20 seconds or something. The element might not exist yet when the website is loaded. Also see waitForElement, which will make it wait for that element.

from capture-website.

IsaacLaquerre avatar IsaacLaquerre commented on August 18, 2024

I just tried, doesn't work :(

I tried putting a 20s delay and waited for the ad wrapper to load before hiding it

{
        delay: 20,
        waitForElement: "#mys-content",
        elements: ".character",
        hideElements: [
            "#mys-content"
        ],
        fullPage: true
}

image

from capture-website.

IsaacLaquerre avatar IsaacLaquerre commented on August 18, 2024

Update: Even framing it around a simple <p class="entity-name"> doesn't render it, it simply stays at position 0, 0 and takes a screenshot,

I changed the width and height options to 50 each (because the image I need is 50px by 50px) and it just takes a picture of the top left corner of the webpage

image

from capture-website.

 avatar commented on August 18, 2024

I believe that instead of iterating over potentially non-existing elements on the page

if (options.hideElements) {
    await Promise.all(options.hideElements.map(selector => page.$$eval(selector, hideElements)));
}

It could be more beneficial to actually inject a style element to the page like this:

if (options.hideElements) await page.addStyleTag({
    content: `${options.hideElements.join(', ')} { display: none; }`
});

This way there should not be any situation when the element that is supposed to be hidden is not loaded when element hiding executes.

from capture-website.

sindresorhus avatar sindresorhus commented on August 18, 2024

@krnik Good idea! 👌

from capture-website.

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.