try-puppeteer | Run Puppeteer code in the cloud | Automation library
kandi X-RAY | try-puppeteer Summary
kandi X-RAY | try-puppeteer Summary
Run Puppeteer scripts in the cloud.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of try-puppeteer
try-puppeteer Key Features
try-puppeteer Examples and Code Snippets
Community Discussions
Trending Discussions on try-puppeteer
QUESTION
I would like to do a web-scraping using Puppeteer. It would be to obtain data from an external URL when the user clicks a button within my application. My application would have to visit an external URL, fill out a form, click on a button, get the data returned and display it to the user within my application. It is an internal project, at first, a small project.
I wrote a test code to use Puppeteer using the website: https://try-puppeteer.appspot.com/
Worked perfectly. Great!
However, I was unable to get my code to run on my domain with shared hosting on Locaweb. It seems to me that I depend on changes on the server to be able to run Puppeteer, is that right?
Is there a free place where I can host my code and run with Puppeteer like I did at https://try-puppeteer.appspot.com/? If you don't have a free option to suggest, could you suggest a low cost option that works?
Thank you!
...ANSWER
Answered 2020-Nov-20 at 14:11Steps:
- You would need to create a simple expressjs api.
- Host the api somewhere (there are thousands of vps and cloud hosting providers like digitalocean/linode etc.)
- Access that rest api using frontend (typically an ajax call)
There is indeed some free services, but they would be a bit more complex. You would need to learn about some serverless functions. Try searching for,
- AWS lambda
- Netlify functions
- Firebase functions
- Google cloud functions
- Google cloud run.
QUESTION
Aw man, I have been trying to work with this for a long time and I'm so stuck.
I need to walk a series of DOM objects, and extract info from each using XPath selectors. My source HTML does not have any identifying IDs or classes on its elements so there's a lot of walking.
Here's some (very simplified) sample code. The goal is to get a list of LI elements, then use more selectors on each of the elements to extract the names inside the spans.
Simplified sample code: (https://try-puppeteer.appspot.com/)
...ANSWER
Answered 2020-May-10 at 07:23I do not think you can use Puppeteer API inside page.evaluate()
: it executes its function argument code in the pure browser context, so try to use just Web API here. Here are two equivalent ways (with selectors and XPath) to achieve your goal:
QUESTION
I am trying out Puppeteer. This is a sample code that you can run on: https://try-puppeteer.appspot.com/
The problem is this code is returning an array of empty objects:
[{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]
Am I making a mistake?
...ANSWER
Answered 2017-Sep-24 at 02:51The values returned from evaluate function should be json serializeable. https://github.com/GoogleChrome/puppeteer/issues/303#issuecomment-322919968
the solution is to extract the href values from the elements and return it.
QUESTION
I am trying to generate pdf with multiple iframes using puppeteer. One issue I encounter is that if I embed something like google maps, google maps will do lazily load(it only loads when the element is in view point of the browser. One solution is to scroll through different iframes on the page and set a wait time for each iframe to load.
here is what I have so far (able to test in https://try-puppeteer.appspot.com/) puppeteer: version 1.9.0, I also tried in 1.12.0, could not make the scroll to work nor the timeout.
...ANSWER
Answered 2019-Feb-22 at 23:44This code has some issues:
frames
is a non-serializable object from Node.js context so it cannot be transferred in the browser context as is.- All
setTimeout()
callbacks will be called at once after 2 sec so each frame will not have enough time to be loaded. - These
setTimeout()
callbacks are not awaited:page.evaluate()
returns before these 2 sec pass and pdf creation happens before iframe loading.
You can try this approach:
QUESTION
I'm using puppeteer to generate pdf of a web page. But the issue is table heading is not appearing in all the pages. Please find the code below.
...ANSWER
Answered 2018-Sep-04 at 07:17I've got the solution. I had to upgrade puppeteer 1.5.0 to 1.7.0
Thanks
QUESTION
The function setValue
receives a value and returns a function. Inside the second function I'm trying to console log the value of value
but I get
ANSWER
Answered 2018-Jun-02 at 17:19This is a problem that is common to any library that is executed in Node.js and evaluates code in browser (Protractor, TestCafe, Nightmare, etc). A function is stringified and passed to a browser as a string. Original scope of (input) => { console.log(value) }
is lost, and value
is expected to be a global, which is undefined.
As the documentation mentions, additional arguments are supposed to be passed to $eval
.
It should be:
QUESTION
I have the following setup:
Angular Front-end
MongoDb database
NodeJS/Express backend for API (+ puppeteer)
steps to deployment:
1. ng build -prod --> creates dist in /server
2. gcloud app deploy (Node.js + Express + Puppeteer + Dockerfile config*)
Because puppeteer is basically chrome; some libraries which aren't given to me, had to be uploaded. No problem, Docker to the rescue.
...ANSWER
Answered 2017-Nov-17 at 16:25I'm not entirely sure how billing works on Google Cloud. If it's message throughput then running headless Chrome is going to be expensive no matter what since it sends requests through WebSockets (meaning at a cost, likely).
This is something that browserless is designed bottom-up for: headless browsers in the cloud. I've also open-sourced the underlying docker images here if you're interested.
I think the bottom line is that many/most providers out there just really aren't well setup to handle binaries executing like a browser. Either their way of deploying makes it tough, or that their methodologies behind billing make it expensive. Believe me when I say that your issue regarding billing and transparency aren't the first I have encountered.
QUESTION
I am trying to modify this build: https://github.com/ebidel/try-puppeteer
I noticed that there are 2 package.json
(and server.js) files.
root (https://github.com/ebidel/try-puppeteer/blob/master/package.json)
backend (https://github.com/ebidel/try-puppeteer/blob/master/backend/package.json)
Why do they deploy the backend and front end separately, with 2 express servers? Is this best practice? Design overkill?
What is the purpose of having two server.js files (or two servers) in one project?
Does it have a hierarchy system I overlooked?
Additionally, how do I deploy this project? from root of from backend?
...ANSWER
Answered 2017-Oct-31 at 16:24You should deploy both, root is the frontend. From root :
QUESTION
I’m trying check if elements are available on a page from within a function, if the element is on the page, good, continue with the code, if not, log the error.
Using the try puppeteer page, here is what I tried:
...ANSWER
Answered 2017-Oct-29 at 17:31You can use this variant to check if the element is in the page or not.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install try-puppeteer
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page