chrome-headless | A simple , practical Chrome headless script example | Automation library
kandi X-RAY | chrome-headless Summary
kandi X-RAY | chrome-headless Summary
A simple Node.js script that interacts with an instance of Chrome headless in order to take a screenshot.
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 chrome-headless
chrome-headless Key Features
chrome-headless Examples and Code Snippets
Community Discussions
Trending Discussions on chrome-headless
QUESTION
I am getting error
"java.lang.AssertionError: failed features: feature.demo-01: demo-01.feature:16 - javascript evaluation failed: input('#login_field','dummy'), ReferenceError: "input" is not defined in at line number 1"
on running the below feature
Feature: browser automation 1
...ANSWER
Answered 2020-Mar-02 at 00:34You must be on an old version of Karate. Use 0.9.5.
Maybe try the ZIP Release first and get familiar: https://github.com/intuit/karate/wiki/ZIP-Release
QUESTION
Use https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ to gather a srvflx candicate.
Problem:Cant receive srvflx candicate on Ubuntu Server(Linux). Works on Windows.
Step to reproduce: OS Ubuntu 19.04 installationsudo apt-get update && apt-get upgrade
sudo ufw disable
curl ipecho.net/plain
// Returns a pingable ip
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash - && sudo apt-get install -y nodejs
mkdir -p /tmp/puppeteertest && cd /tmp/puppeteertest && npm init
npm i puppeteer --save
- Install all libs listed here https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix
sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
- vi index.js // Create index.js with code below
ANSWER
Answered 2019-Dec-02 at 15:53If your machine is configured with a public IP and not behind NAT (which is what the host candidate for ubuntu suggests) there will be no srflx candidate returned as the serverreflexive address is the same as the host address. See https://tools.ietf.org/html/rfc8445#section-5.1.3 for details.
QUESTION
I'm trying to select and console.log()
the NodeList of all the links of a website in the terminal. However I'm unable to do so accessing certain websites - google.com, facebook.com, instagram.com.
I know that elements are there, because I can certainly log them in the actual Chromium console, which loads separately, using document.querySelectorAll('a')
. But when I'm trying to extract and log links in Node terminal, using
ANSWER
Answered 2019-Aug-15 at 07:26You are trying to return the DOM
elements with the page.evaluate
method, but this is impossible because If the function passed to the page.evaluate
returns a non-Serializable value, then page.evaluate
resolves to undefined
as in your case.
You can use the page.$$ method instead if you want to get an array of the ElementHandle
.
Example:
QUESTION
UPDATE
As @Joaquín said, the base image was lacking dependencies. After a lot of research along with trial and error, I settled on using the heavy servercore image along with the necessary fonts required by Chrome. You can find my test app and Dockerfile on my github.
I was able to get it running in Azure App Service as a Windows container, but the image is many times larger and much slower startup time than my Linux version. I'm still very new to Docker containers, so it's been interesting so far.
Running my puppeteer app in a Windows container in Azure App Services ends up with
UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
Yet, it works flawlessly in a Linux container in Azure App Services. Do I have to do something particularly special to get it to work in a Windows container? Or is it futile due to the sandboxing limitations in a Windows app service (container or not)? Though, if this were the case, then I would've expected a spawn UNKNOWN
error...
Some of the things I've tried included using the following puppeteer.launch() options:
ignoreDefaultArgs: ['--disable-extensions']
(per troubleshooting)executablePath: ''
Here's the error and stack trace
...ANSWER
Answered 2019-Aug-24 at 00:29When it comes down to a Windows Containers, there is no limitation on the App Service sandbox since Hyper-V is being used as the sandbox for containers on App Service.
The only reason for the failure to launch chrome inside the container is that the base image of the Windows Container is missing some dependency that chrome needs.
If you share dockerfile, I would like to repro the issue.
QUESTION
We have used phantomjs on previous days for generating pdf with server-side prince tool. Nowadays we like to change the headless browser from phantomjs to another one.
I research about which one is quickly rendering both phantomjs and puppeteer. In my case Reporting app to generate the PDF, only I test it with puppeteer and phantomjs. phantomjs quickly process the HTML compare to puppeteer.
And then I learn google-chrome-headless options to generate the PDF. It looks like a Chrome browser GUI application built-in modules. I am working with nodejs application. I am used with the below command from the command line
...ANSWER
Answered 2019-Jul-10 at 15:04Here are what these tools do,
- phantomJS is a scriptable Headless WebKit. Similar to chromium browser. It's deprecated and the project is archived.
- chromium: Chromium is Google's open-source web browser project. It is a fully functional browser on its own and supplies the vast majority of code for the Google Chrome browser.
- chromium-headless: Headless Chrome is shipping in Chrome 59. It's a way to run the Chrome browser in a headless environment. Essentially, running Chrome without chrome! It brings all modern web platform features provided by Chromium and the Blink rendering engine to the command line.
- Puppeteer: Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol. Puppeteer runs headless by default, but can be configured to run full (non-headless) Chrome or Chromium.
You can control an instance of chromium and chromium headless with puppeteer. Of course it will allow you to provide arguments and generate PDF using that API.
You can control the same API using Chrome CLI and Puppeteer.
Here is how you can use chromium headless to generate a pdf of a website.
QUESTION
I'm trying to make my online bot undetectable. I read number of articles how to do it and I took all tips together and used them. One of them is to change window.navigator.webdriver
.
I managed to change window.navigator.webdriver
within puppeteer by this code:
ANSWER
Answered 2019-May-28 at 07:03Try this,
First, remove the definition, it will not work if you define and delete from prototype.
QUESTION
I'm trying to export an image rendered with WebGL on a linux server without a GPU. To do this I'm using headless Chrome however the exported image is black (example exported image, taking a screenshot of page shows its just canvas that is black). I was hoping for some help figuring out why this is happening.
To export the image I render the image into a canvas, export data via canvas.toDataURL('image/jpeg')
and then post the data to the server. I'm using Pixi.js for rendering, if I use canvas renderer then everything works on the server; It's WebGL rendering thats not working. It's worth noting the WebGL render works fine in Chrome 63 on a Macbook.
To control Chrome I'm using Puppeteer. All I'm doing is opening a page, waiting a second, and then closing it again:
...ANSWER
Answered 2018-Jan-08 at 11:06There's an open bug which affects systems without X11 libraries: crbug.com/swiftshader/79. It prevents Chrome OS from running with SwiftShader, but the same issue would also happen on a headless Linux system which has no X11 support.
Fortunately it should be feasible to install X11 and get things running. I'm not 100% sure which packages provide the necessary libraries, but try these: xorg xserver-xorg xvfb libx11-dev libxext-dev libxext-dev:i386
Eventually the SwiftShader bug will be fixed so it doesn't require X11 whatsoever.
QUESTION
I have this gitlab-ci.yml to build my SpringBoot app:
...ANSWER
Answered 2018-Dec-20 at 13:29You do not "combine" docker containers. You put different services into different containers and run them all together. Look at kubernetes
(it has now generic support in gitlab
) or choose simpler solution like docker-compose
or docker-swarm
.
For integration tests we use docker-compose
.
Anyway, if using docker-compose
, you will probably fall into the situation that you need so-called docker-in-docker
. It depends on the type of worker, you use to run your gitlab jobs. If you use shell
executor, everything will be fine. If you are using docker
executor, you will have to setup it properly, because you cant call docker
from docker
without additional manual setup.
If using several containers is not your choice and you definitely want to put all in one container, the recommended way is to use supervisor to launch processes inside container. One of the options is supervisord
: http://supervisord.org/
QUESTION
Trying to run chrome headless as a container (Image: https://hub.docker.com/r/alpeware/chrome-headless-trunk) in my docker-compose and connecting to it from another container.
ProblemTo actually connect to chrome inside the container, I first need to retrieve the webSocketDebuggerUrl, which is available at http://0.0.0.0:9222/json/version of the chrome-headless.
The Problem is: my request to this path always fails with
RequestError: Error: connect ECONNREFUSED 0.0.0.0:9222
and cant get the webSocketDebuggerUrl to connect to chrome.
Some more InfoAlso if I visit http://0.0.0.0:9222/json/version in my browser myself, copy the url and hardcode it into my puppeteer.connect(), it ONLY works as expected, if I replace the address of '0.0.0.0' to my (linked) container-name (specified in docker-compose): http://chrome:9222/json/version
If I try to request the webSocketDebuggerUrl from /json/version while using container-name address (http://chrome:9222/json/version) i get the error
My Code (abstraction) ...StatusCodeError: 500 - "Host header is specified and is not an IP address or localhost."
ANSWER
Answered 2018-Dec-20 at 11:56Well, since the errorMessage from the 500 said "host is specified", ist just set that header to empty, and now I can successfully request the webSocketDebuggerUrl.
The solution feels a bit hacky, so if anyone has a suggestion on how to improve it I'd be happy:
QUESTION
I'm trying to zip my dist folder and post to it Azure's kudu zipdeploy endpoint but I keep getting this error regardless of the fact that I have installed a zipping package myself.
My docker image: weltn24/up-docker-node-chrome-headless
on tag: chrome-66_node-10.0_yarn-1.6.0
The part that fails in my yml file:
...ANSWER
Answered 2018-Nov-12 at 14:47Correct script below:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install chrome-headless
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