google-chrome-headless

additional options in Chrome headless print-to-pdf

≯℡__Kan透↙ 提交于 2019-11-29 01:19:45
I need help one more time. I am trying to print a page to pdf using headless feature of the chrome. However, header and footer is present in the pdf. I found that this option as been implemented in Devtools. https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF However, i can't find how can i use these options in CLI. Also is it possible to invoke the Devtools from selenium? Additionally how can i invoke Page.PrintToPDF in Dev tools. I tried to run the command in Console. It is showing Page is undefined. nuccio Add this CSS to the page your creating into a PDF to

DevTools listening on ws://127.0.0.1:57671/devtools/browser/8a586f7c-5f2c-4d10-8174-7a7bf50e49b5 with Selenium and Python

偶尔善良 提交于 2019-11-28 14:28:58
I am using python + selenium for web browser automation and getting this error. DevTools listening on ws://127.0.0.1:57671/devtools/browser/8a586f7c-5f2c-4d10-8174-7a7bf50e49b5 [5096:1196:0909/183254.362:ERROR:mf_helpers.cc(14)] Error in dxva_video_decode_accelerator_win.cc on line 517 The problem arises when the program reaches this part of code:- def send_comments(driver): add_comments = driver.find_elements_by_class_name('add') comments = driver.find_elements_by_xpath("//form[@class='addCommentexpand']//textarea[contains(@placeholder,'Add a comment')]") submit_comments = driver.find

Is it possible to run Google Chrome in headless mode with extensions?

纵饮孤独 提交于 2019-11-28 05:45:57
I cannot use my currently installed extensions in Google Chrome using headless mode. Is there any way to enable them? An easy way to check if the extensions work is by adding, for example, the " Comic Sans Everything " extension. So Google looks like that: However, if I take a screenshot of the page using the headless mode ( google-chrome --headless --disable-gpu --screenshot https://www.google.com ), the result is: No, it's not possible, and Chrome developers decided against implementing it in any near future due to complexity of the task. If you look at that issue you may get the idea that

Protractor file download test fails when headless chrome

廉价感情. 提交于 2019-11-28 04:19:10
问题 I am having an issue with a protractor test. It was working, but now (even thought nothing has changed) it is not. The test is just opening the app (web application) and clicking on a button to download an image. The download should start straight away. The problem is that the next instruction after the download event throws an exception, Failed: chrome not reachable. I am using the latest chrome and chrome driver versions. The capabilites section for protractor is like this: capabilities: {

Chrome headless file download with Selenium in Python

心已入冬 提交于 2019-11-28 04:10:45
问题 In headless mode, Chrome defaults to disallowing file downloads. However, recently they added an option to DevTools to enable this behavior: https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setDownloadBehavior Using Selenium with ChromeDriver in Python, how do I allow file downloads? 回答1: For those who are still looking , That's how i did it : def enable_download_in_headless_chrome( driver, download_dir): #add missing support for chrome "send_command" to selenium webdriver

Debugging with headless browser

自作多情 提交于 2019-11-28 00:46:12
问题 I have a WebDriver testsuite, which operates different when I execute it in normal and headless browser. There is an element which is not found when I execute it in headless mode, but found when I use the same code, same driver in normal mode. I use this flag to set headless mode: chromeOptions.addArguments("--headless"); There is ChromeDriver 2.31 and WebDriver 3.5.2 in use. How could I debug this? 回答1: There are two ways to debug. You can get Page Source and check what is different. Now

Puppeteer - Protocol error (Page.navigate): Target closed

微笑、不失礼 提交于 2019-11-27 16:47:45
问题 As you can see with the sample code below, I'm using Puppeteer with a cluster of workers in Node to run multiple requests of websites screenshots by a given URL: const cluster = require('cluster'); const express = require('express'); const bodyParser = require('body-parser'); const puppeteer = require('puppeteer'); async function getScreenshot(domain) { let screenshot; const browser = await puppeteer.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage'] });

Headless Chrome REPL not working

╄→гoц情女王★ 提交于 2019-11-27 15:10:51
问题 When I try to run: google-chrome --headless --disable-gpu --repl http://google.com getting infinite: [0829/155519.758686:INFO:headless_shell.cc(303)] Type a Javascript expression to evaluate or "quit" to exit. >>> {"result":{"type":"undefined"}} >>> {"result":{"type":"undefined"}} >>> {"result":{"type":"undefined"}} >>> {"result":{"type":"undefined"}} ... Google Chrome 60.0.3112.113 on Ubuntu 16.04 Is it a bug in Chrome? 回答1: Use the binary /opt/google/chrome/chrome directly not google-chrome

How to use puppeteer to dump WebSocket data

本小妞迷上赌 提交于 2019-11-27 13:07:59
问题 I want to get websocket data in this page https://upbit.com/exchange?code=CRIX.UPBIT.KRW-BTC, its websocket URL is dynamic and only valid during the first connection, the second time you connect to it it will not send data anymore. So I wonder that maybe headless chrome can help me to monitor the websocket data. Any ideas? Thanks! 回答1: You actually don't need to do anything complex on this. The URL though seems dynamic, but works fine through code as well. The reason it doesn't work is that

Downloading with chrome headless and selenium

一世执手 提交于 2019-11-27 00:36:58
I'm using python-selenium and Chrome 59 and trying to automate a simple download sequence. When I launch the browser normally, the download works, but when I do so in headless mode, the download doesn't work. # Headless implementation from selenium import webdriver chromeOptions = webdriver.ChromeOptions() chromeOptions.add_argument("headless") driver = webdriver.Chrome(chrome_options=chromeOptions) driver.get('https://www.mockaroo.com/') driver.find_element_by_id('download').click() # ^^^ Download doesn't start # Normal Mode from selenium import webdriver driver = webdriver.Chrome() driver