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
26
votes
6 answers

Puppeteer Button Press

According to https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepresskey-options, you can simulate the pressing of a keyboard button with Puppeteer. Here's what I do: // First, click the search button await…
26
votes
4 answers

Headless automation with Nodejs Selenium Webdriver

I am working with an automation tool which has to be deployed inside an ubuntu server, my wonder is if is possible to use chrome in a silent way with Selenium Webdriver. I've tried the following code so far, but it keeps opening the browser (I'm…
avilac
  • 792
  • 1
  • 8
  • 23
25
votes
2 answers

Limit chrome headless CPU and memory usage

I am using selenium to run chrome headless with the following command: system "LC_ALL=C google-chrome --headless --enable-logging --hide-scrollbars --remote-debugging-port=#{debug_port} --remote-debugging-address=0.0.0.0 --disable-gpu --no-sandbox…
23
votes
3 answers

Want to scrape table using Puppeteer. How can I get all rows, iterate through rows, and then get "td's" for each row?

I have Puppeteer setup, and I was able get all of the rows using: let rows = await page.$$eval('#myTable tr', row => row); Now I want for each row to get "td's" and then get the innerText from those. Basically I want to do this: var tds =…
mirceah13
  • 275
  • 1
  • 2
  • 9
22
votes
6 answers

Alternative to HtmlUnit

I have been researching about the headless browsers available till to date and found HtmlUnit being used pretty extensively. Do we have any alternative to HtmlUnit with possible advantage compared to HtmlUnit? Thanks Nayn
Nayn
  • 3,594
  • 8
  • 38
  • 48
21
votes
3 answers

Why can't I access 'window' in an exposeFunction() function with Puppeteer?

I have a very simple Puppeteer script that uses exposeFunction() to run something inside headless Chrome. (async function(){ var log = console.log.bind(console), puppeteer = require('puppeteer'); const browser = await…
mikemaccana
  • 110,530
  • 99
  • 389
  • 494
21
votes
0 answers

Is it possible to install Headless Chrome without X11 dependencies?

I wonder if is it possible to somehow install Headless Chrome without X11 dependencies, e.g. on a VM or in a Docker container? Currently when I install it from the Chrome repo it downloads lots of useless stuff as dependencies. It takes a long time…
20
votes
7 answers

PHP Headless Browser?

Is there a headless browser library for PHP? Would like something that has a JS engine built into it. FOSS preferred.
StackOverflowNewbie
  • 39,403
  • 111
  • 277
  • 441
20
votes
3 answers

Load a web page into a headless Jasmine spec running PhantomJS

How do I read in a page from localhost into a headless Jasmine spec so test cases can work on the DOM elements? My Gulp task is successfully running Jasmine specs for unit testing, and now I need to build integration tests to verify full web pages…
Dem Pilafian
  • 5,625
  • 6
  • 39
  • 67
20
votes
1 answer

Output client-side console with casper/phantomjs

Going through the casperjs documentation I couldn't find where I could see the console.log from client-side javascript. Is this possible?
19
votes
4 answers

How to extract a JSON object that was defined in a HTML page javascript block using Python?

I am downloading HTML pages that have data defined in them in the following way: ... ... I would like to extract the JSON object defined in…
user971956
  • 3,088
  • 7
  • 30
  • 47
18
votes
4 answers

How to use Selenium with PHP?

I'd like to use Selenium to automate a few web tasks (not for testing). I think I have Selenium RC Server installed, but have no way of writing "test scripts" since I can't find a client driver in PHP (see: http://seleniumhq.org/download/). Is…
StackOverflowNewbie
  • 39,403
  • 111
  • 277
  • 441
17
votes
5 answers

What is a good headless browser to run with protractor?

New User here. After hours of building my smoke and regression tests, I found out after reading many cases online that phantomjs is known to be a trouble to run with protractor. Jenkins has been running phantomjs for all the tasks it has been given…
tosh
  • 337
  • 1
  • 3
  • 13
16
votes
1 answer

Headless browser detection

Do you know any webapps/online tests/online firewalls that are trying to detect if user is using selenium/puppeteer/phantomJS or any other headless browser? I've created my puppeteer online crawler. I've changed many different stuff like…
BT101
  • 3,666
  • 10
  • 41
  • 90
16
votes
3 answers

How to point Puppeteer to local images/fonts?

I want to generate images from the HTML string using Puppeteer. For now I have something like this: const html = _.template(`

Hello {{ test }}!

alt text
bdrtsky
  • 163
  • 1
  • 1
  • 4
1
2
3
49 50