headless-browser

Can i use HtmlUnit to listen for resource loading events?

时间秒杀一切 提交于 2020-01-05 03:00:08
问题 I'm trying to use HtmlUnit to detect resources (scripts, images, stylesheets, etc) that fail to load on a webpage. I've tried new WebConnectionWrapper(webClient) { @Override public WebResponse getResponse(WebRequest request) throws IOException { WebResponse response; response = super.getResponse(request); System.out.println(response.getStatusCode()); return response; } }; to no avail. It doesn't seem to handle CSS, images or JS, despite HtmlUnit logging: statusCode=[404] contentType=[text

Can i use HtmlUnit to listen for resource loading events?

女生的网名这么多〃 提交于 2020-01-05 03:00:06
问题 I'm trying to use HtmlUnit to detect resources (scripts, images, stylesheets, etc) that fail to load on a webpage. I've tried new WebConnectionWrapper(webClient) { @Override public WebResponse getResponse(WebRequest request) throws IOException { WebResponse response; response = super.getResponse(request); System.out.println(response.getStatusCode()); return response; } }; to no avail. It doesn't seem to handle CSS, images or JS, despite HtmlUnit logging: statusCode=[404] contentType=[text

Selenium Firefox headless returns different results

大城市里の小女人 提交于 2020-01-04 04:07:07
问题 When i scrape page that contains products with usage of headless option i get different results. For the same question one time i get results that are not sorted, and another time with proper sorted order. Selenium firefox browser: firefox_options = Options() firefox_options.headless = True browser = webdriver.Firefox(options=firefox_options, executable_path=firefox_driver) According to this post: "firefox does not send different headers when using the headless option". How to use headless

Using QWebEngine to render an image

旧时模样 提交于 2020-01-01 09:15:22
问题 I'm looking to replace QWebKit with QWebEngine in my headless renderer. I initialise the page with load() and connect a slot to loadFinished() to generate the final .PNG image. This used to work fine with WebKit but fails with QWebEngine . Code is as follows... _webView = new QWebEngineView(); .... // Render the HTML to an image QPainter painter(&image); _webView->page()->view()->render(&painter); painter.end(); I receive the following errors : "Asking for share context for widget that does

Easiest way to “browse” to a page and submit form in Java

北城以北 提交于 2020-01-01 08:33:31
问题 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 get the message that the webpage returns to me. The reason I need to actually go to the page and click the button as suppose to just navigating directly to the link is because the you are assigned a session ID every time you log in and click the

Selenium Pyvirtualdisplay Hangs on starting

匆匆过客 提交于 2020-01-01 05:11:06
问题 I have a selenium test which I am trying to run Headlessly on my ubuntu server. It uses pyvirtualdisplay and xephyr. Though the script is running fine in my local system, it hangs when I run it in the server. I have tried to clear memory and restarting the server. But no luck. The script looks something like this : from selenium import webdriver from pyvirtualdisplay import Display display = Display(visible=0, size=(1366, 768)) display.start() driver = webdriver.Firefox() driver.set_window

How do I make Python, QT, and Webkit work on a headless server?

不羁的心 提交于 2019-12-31 16:30:36
问题 I have Debian Linux server that I use for a variety of things. I want it to be able to do some web-scraping jobs I need done regularly. This code can be found here. import sys from PyQt4.QtGui import * from PyQt4.QtCore import * from PyQt4.QtWebKit import * class Render(QWebPage): def __init__(self, url): self.app = QApplication(sys.argv, False) # Line updated based on mata's answer QWebPage.__init__(self) self.loadFinished.connect(self._loadFinished) self.mainFrame().load(QUrl(url)) self.app

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

自古美人都是妖i 提交于 2019-12-30 08:05:13
问题 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 pre-built binaries) based on the instructions I found here and then I used the following code to launch it through Selenium: from selenium import webdriver from selenium.webdriver.chrome.options import Options l_option = Options() l_option.add

Output client-side console with casper/phantomjs

蓝咒 提交于 2019-12-30 03:44:16
问题 Going through the casperjs documentation I couldn't find where I could see the console.log from client-side javascript. Is this possible? 回答1: I'm not really sure to fully understand your question, but you can do something like the following: var casper = require('casper').create({ logLevel: "debug" }); casper.on('remote.message', function(message) { this.echo(message); }); casper.start('http://google.com/', function() { this.evaluate(function sendLog(log) { // you can access the log from

Protractor throws error an X Display is required for headless chrome 59

血红的双手。 提交于 2019-12-25 08:42:19
问题 While running ng e2e I get the following ✓ should display message saying sign up ✗ should be able to sign up with a valid user - Failed: unknown error: an X display is required for keycode conversions, consider using Xvfb (Session info: headless chrome=59.0.3071.71) (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 3.13.0-48-generic x86_64) (Session info: headless chrome=59.0.3071.71) (Driver info: chromedriver=2.29.461571