chrome-headless | A simple , practical Chrome headless script example | Automation library

 by   GeekLaunch JavaScript Version: Current License: No License

kandi X-RAY | chrome-headless Summary

kandi X-RAY | chrome-headless Summary

chrome-headless is a JavaScript library typically used in Automation, Nodejs applications. chrome-headless has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

A simple Node.js script that interacts with an instance of Chrome headless in order to take a screenshot.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              chrome-headless has a low active ecosystem.
              It has 7 star(s) with 1 fork(s). There are 2 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 0 open issues and 1 have been closed. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of chrome-headless is current.

            kandi-Quality Quality

              chrome-headless has no bugs reported.

            kandi-Security Security

              chrome-headless has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              chrome-headless does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              chrome-headless releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of chrome-headless
            Get all kandi verified functions for this library.

            chrome-headless Key Features

            No Key Features are available at this moment for chrome-headless.

            chrome-headless Examples and Code Snippets

            No Code Snippets are available at this moment for chrome-headless.

            Community Discussions

            QUESTION

            Javascript evaluation failed: input('#login_field','dummy') on running karate feature
            Asked 2020-Mar-02 at 00:34

            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:34

            You 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

            Source https://stackoverflow.com/questions/60478718

            QUESTION

            No srvflx adress with Ubuntu and Puppeteer
            Asked 2019-Dec-02 at 15:53
            What I want todo

            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 installation
            • sudo apt-get update && apt-get upgrade
            • sudo ufw disable
            • curl ipecho.net/plain // Returns a pingable ip
            Setup Puppeteer:
            • 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:53

            If 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.

            Source https://stackoverflow.com/questions/59142220

            QUESTION

            PUPPETEER - unable to extract elements on certain websites using page.evaluate(() => document.querySelectorAll())
            Asked 2019-Nov-02 at 11:44

            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:26

            You 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:

            Source https://stackoverflow.com/questions/57504201

            QUESTION

            Does puppeteer headless chrome work in a Windows container in Azure App Service?
            Asked 2019-Aug-28 at 00:29

            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:

            1. ignoreDefaultArgs: ['--disable-extensions'] (per troubleshooting)

            2. executablePath: ''

            Here's the error and stack trace

            ...

            ANSWER

            Answered 2019-Aug-24 at 00:29

            When 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.

            Source https://stackoverflow.com/questions/57620361

            QUESTION

            Which one of the headless browse do i choose?
            Asked 2019-Jul-10 at 15:04

            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:04

            Here 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.

            Source https://stackoverflow.com/questions/56972051

            QUESTION

            Changing window.navigator within puppeteer to bypass antibot system
            Asked 2019-May-30 at 16:01

            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:03

            Try this,

            First, remove the definition, it will not work if you define and delete from prototype.

            Source https://stackoverflow.com/questions/56335066

            QUESTION

            Rendering WebGL image in headless chrome without a GPU
            Asked 2019-Feb-28 at 21:32

            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:06

            There'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.

            Source https://stackoverflow.com/questions/48011613

            QUESTION

            How to combine Dockerfiles in gitlab ci?
            Asked 2018-Dec-20 at 13:45

            I have this gitlab-ci.yml to build my SpringBoot app:

            ...

            ANSWER

            Answered 2018-Dec-20 at 13:29

            You 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/

            Source https://stackoverflow.com/questions/53869234

            QUESTION

            Requesting webSocketDebuggerUrl from Chrome-Headless in Docker Container
            Asked 2018-Dec-20 at 11:56
            Setup

            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.

            Problem

            To 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 Info

            Also 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

            StatusCodeError: 500 - "Host header is specified and is not an IP address or localhost."

            My Code (abstraction) ...

            ANSWER

            Answered 2018-Dec-20 at 11:56

            Well, 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:

            Source https://stackoverflow.com/questions/53867751

            QUESTION

            GitLab Pipelines: zip: command not found after installing zip on docker image?
            Asked 2018-Nov-12 at 14:47

            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:47

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install chrome-headless

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/GeekLaunch/chrome-headless.git

          • CLI

            gh repo clone GeekLaunch/chrome-headless

          • sshUrl

            git@github.com:GeekLaunch/chrome-headless.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link