Comments (5)
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.
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
}
from capture-website.
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
from capture-website.
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.
@krnik Good idea! 👌
from capture-website.
Related Issues (20)
- Capturing elements inside `#shadow-root` HOT 2
- Can it be changed using networkidle0 or open options HOT 1
- Error: Could not find expected browser (chrome) locally on version 1.4.0 CJS HOT 3
- Feature Request: use puppeteer-core when Chrome is available in system HOT 3
- Error: createRequire only supports 'file://' URLs for the 'filename' parameter. HOT 1
- Support PDF as output type HOT 4
- Feature: Option for allowing CORS
- TLS certificate HOT 1
- Consider replacing Puppeteer with Playwright HOT 2
- Could be useful to support a commonjs version HOT 2
- Consider add some code or event handler before goto page
- engine.bin size keeps on increasing untill no space left on device
- How to pass proxy configuration ? HOT 1
- Recommendation for multiple URL performance? HOT 1
- Class extends value undefined is not a constructor or null (NuxtJS) HOT 1
- [Feature Request] - Allow redirection of page console output to host console.log without forcing headless = false HOT 2
- Akamai error with TLS
- Can't resolve node:fs HOT 1
- Does not work on Vercel Serverless functions — "Could not find browser (chrome) locally" HOT 1
- Reading from "node:fs" is not handled by plugins (Unhandled scheme) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from capture-website.