Questions tagged [headless-browser]

A headless browser is a web browser without a graphical user interface. They are used to provide content of web pages to other programs.

A headless browser is a browser without a GUI. In most cases, it can be accessed from a command line.

They are typically used for automated testing of websites.

Examples include:

748 questions
16
votes
3 answers

How can I dynamically inject functions to evaluate using Puppeteer?

I am using Puppeteer for headless Chrome. I wish to evaluate a function inside the page that uses parts of other functions, defined dynamically elsewhere. The code below is a minimal example / proof. In reality functionToInject() and…
mikemaccana
  • 110,530
  • 99
  • 389
  • 494
16
votes
4 answers

Real headless browser

I am in charge of testing an enterprise web application that makes heavy use of AJAX. I need to build a system that allows continuous running of tests without human intervention. Currently I am mostly interested in load testing but I want the same…
user573225
  • 209
  • 1
  • 2
  • 6
15
votes
2 answers

Puppeteer: How to get the contents of each element of a nodelist?

I'm trying to achieve something very trivial: Get a list of elements, and then do something with the innerText of each element. const tweets = await page.$$('.tweet'); From what I can tell, this returns a nodelist, just like the…
15
votes
1 answer

Selenium ChromeDriver does not recognize newly compiled Headless Chromium (Python)

I am trying to use the new (2016) headless version of Chromium with Selenium/ChromeDriver (In the past, I used Firefox with xfvb but this promises to be much better). I have compiled a headless version of Chromium from sources (I did not find any…
15
votes
2 answers

Using Chrome with `--headless` switch to measure user page load times

I'm trying to improve the performances of my web server and would like to get an accurate measure on how long it takes the user to load the page. The way I imagined this would be to simulate concurrent requests from users and track how page load…
Filip Dupanović
  • 32,650
  • 13
  • 84
  • 114
14
votes
5 answers

Creating a headless Chrome instance in Python

This question describes my conclusion after researching available options for creating a headless Chrome instance in Python and asks for confirmation or resources that describe a 'better way'. From what I've seen it seems that the quickest way to…
Trindaz
  • 17,029
  • 21
  • 82
  • 111
14
votes
6 answers

Headless Chrome Node API and Puppeteer installation

Throughout the process of installation chrome headless on a clean ubuntu 18.04 i faced quite a few issues. The setup guide on github is not sufficient for a clean ubuntu 18.04 The following are some errors and answer / solutions to setting up…
CodeGuru
  • 3,645
  • 14
  • 55
  • 99
14
votes
3 answers

Prevent CSS/other resource download in PhantomJS/Selenium driven by Python

I'm trying to speed up Selenium/PhantomJS webscraper in Python by preventing download of CSS/other resources. All I need to download is img src and alt tags. I've found this code: page.onResourceRequested = function(requestData, request) { if…
YPCrumble
  • 26,610
  • 23
  • 107
  • 172
13
votes
2 answers

How to get all links from the DOM?

According to https://github.com/GoogleChrome/puppeteer/issues/628, I should be able to get all links from < a href="xyz" > with this single line: const hrefs = await page.$$eval('a', a => a.href); But when I try a simple: console.log(hrefs) I only…
Vega
  • 2,661
  • 5
  • 24
  • 49
13
votes
1 answer

Headless Firefox in Selenium C#

I want to run firefox headless. Not hide the browser window or open it in a virtual desktop, Firefox supports headless mode by using "-headless" flag. Problem is I know how to do it in chrome but not in Firefox. My code: using System; using…
Biswajit Chopdar
  • 831
  • 5
  • 12
  • 31
13
votes
1 answer

chrome in --headless mode: Provide credentials/auth for proxy

I am running chrome the following way: google-chrome --headless --disable-gpu --dump-dom --disable-web-security Due to a corporate proxy, it seems to be bumping into a authentication popup that is asking to input credentials. How do I inject these…
cgsd
  • 1,242
  • 2
  • 13
  • 25
13
votes
1 answer

Can chrome headless browser be used to save the complete web page with resources?

I am looking to use the chrome headless browser to replicate the 'Save As' functionality to save the complete web page with all its resources. Is there a way to do this? I tried the --print-to-pdf and --screenshot options and looking to explore the…
13
votes
5 answers

How to hide Chrome Driver in python?

Though I knew people asked this question but I didn't find suitable answer so I asked again. I used PhantomJS to scrape web site, but it is very slow on Mac, so I want to tru Chrome but Chrome show browser that is is bad, can I hide it? I tried code…
mikezang
  • 2,291
  • 7
  • 32
  • 56
12
votes
6 answers

Easiest way to "browse" to a page and submit form in Java

What I need to do is browse to a webpage, login, then browse to another webpage on that site that requires you to be logged in, so it needs to save cookies. After that, I need to click an element on that page, in which I would fill out the form and…
user1947236
  • 673
  • 3
  • 12
  • 27
11
votes
1 answer

Running chrome headless on linux without xorg

Is it possible to install and run chrome headless on a headless Linux box without installing the audio and xorg dependencies? If not, then is there a special headless build of chrome/chromium which doesn't pull xorg and audio libs?
ccpizza
  • 28,968
  • 18
  • 162
  • 169
1 2
3
49 50