headless-browser

Run Headless JsTestDriver?

亡梦爱人 提交于 2019-12-07 11:05:30
问题 Is there a way to use jsTestDriver in a headless state where it loads the browsers but does so headlessly (you can't see the browser) or it loads them minimized? 回答1: There is no way to configure JsTestDriver to open the browser minimized. And you have to open the browsers because they run the JavaScript code. You can try to create a virtual monitor and open the browser there. Under linux you can use xvfb for this, for example xvfb-run java -jar JsTestDriver-1.3.3d.jar --tests all --port 4224

HtmlUnit not creating HtmlPage object

大兔子大兔子 提交于 2019-12-07 08:52:16
问题 I'm very new to HtmlUnit and I'm trying to scrape a website that uses Javascript to edit the code. I heard HtmlUnit was the best way to go as it returns the final code using a headless browser. However as you will see I cannot even get past creating a HtmlPage object without getting a huge and impossible to understand exception thrown (at least given my virtually null experience with HtmlUnit). Here is my code: import com.gargoylesoftware.htmlunit.*; import com.gargoylesoftware.htmlunit.html

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

懵懂的女人 提交于 2019-12-07 07:23:47
问题 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 document.querySelectorAll() method in the browser. How do I just loop over it and get what I need? I tried various stuff, like: [...tweets].forEach(tweet => { console.log(tweet.innerText) }); 回答1: page.$$(): You can use a combination of elementHandle.getProperty() and

How do I use Selenium Webdriver on headless Chrome?

混江龙づ霸主 提交于 2019-12-07 03:31:03
问题 I'm learning to use Selenium for basic things like taking a screenshot, scraping, and testing and would like to use it with headless Chrome, which is now stable as of Chrome 59. I have been able to take a screenshot using the 'selenium-webdriver' gem and chromedriver, but not headless. Here is the ruby script that I am running which hangs after starting to initialize the driver require 'rubygems' require 'selenium-webdriver' Selenium::WebDriver.logger.level = :debug p 'initializing driver'

Want to scrape table using puppeteer.js. How can I get all rows, iterate through rows and then get “td's” for each row

风流意气都作罢 提交于 2019-12-07 01:45:09
问题 I have puppeteer js setup and was able get all rows using let rows = await page.$$eval('#myTable tr', row => row); Now I want for each row to get "td's" and then get inner text from those. Basically I want to do this: var tds = myRow.querySelectorAll("td"); where myRow is a table row, with puppeteer.js 回答1: One way to achieve this is to use evaluate that first gets an array of all the TD's then returns the textContent of each TD const puppeteer = require('puppeteer'); const html = ` <html>

Chrome Headless Doesn't work

一笑奈何 提交于 2019-12-07 01:08:59
问题 I've read about the Chrome Headless from developers.google said we can run the Google without UI. Quote from that link : 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. Why is that useful? A headless browser is a great tool for automated testing and server environments where you

Execute browser page/javascript from a script/command-line

最后都变了- 提交于 2019-12-06 04:21:49
问题 Hope this isnt a stupid question. I have recently had an idea about something which I am very curious about. I am a fan of Node.js (not really relevent here I think) and the V8 engine but I was wondering if its possible to run a browser (get it to execute JS) but INTERNALLY. What I mean by that is to create a program (possibly using the V8 engine) which can open a page (as if in the browser) and execute its javascript. For instance say I have the below file hosted on www.mysite.co.uk/home.php

How to run browsers(chrome, IE and firefox) in headless mode?

我的未来我决定 提交于 2019-12-05 20:52:03
问题 I want to integrate JSTestDriver with jenkins-CI. problem is that the build server does not have display. is there a way to run browsers headlessly? Thanks 回答1: If your server is Linux, as mentioned, you can't run IE. But you can run other browsers like Firefox. The trick is to install XVFB on your Jenkins server which allows Firefox to run headless. I've used this setup and it works well. http://www.alittlemadness.com/2008/03/05/running-selenium-headless/ 回答2: Google Chrome now (Chrome 59

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

China☆狼群 提交于 2019-12-05 16:38:28
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 document.querySelectorAll() method in the browser. How do I just loop over it and get what I need? I tried various stuff, like: [...tweets].forEach(tweet => { console.log(tweet.innerText) }); page.$$(): You can use a combination of elementHandle.getProperty() and jsHandle.jsonValue() to obtain the innerText from an ElementHandle obtained with page.$$() : const tweets =

Run Headless JsTestDriver?

你离开我真会死。 提交于 2019-12-05 15:17:01
Is there a way to use jsTestDriver in a headless state where it loads the browsers but does so headlessly (you can't see the browser) or it loads them minimized? There is no way to configure JsTestDriver to open the browser minimized. And you have to open the browsers because they run the JavaScript code. You can try to create a virtual monitor and open the browser there. Under linux you can use xvfb for this, for example xvfb-run java -jar JsTestDriver-1.3.3d.jar --tests all --port 4224 --browser firefox chromium-browser --testOutput jsTests should open the browser in a virtual window. You