google-chrome-headless

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

蓝咒 提交于 2019-11-30 06:05:06
问题 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=

How do I use Headless Chrome in Chrome 60 on Windows 10?

筅森魡賤 提交于 2019-11-30 06:04:48
I've been looking at the following article about Headless Chrome: https://developers.google.com/web/updates/2017/04/headless-chrome I just upgraded Chrome on Windows 10 to version 60, but when I run either of the following commands from the command line, nothing seems to happen: chrome --headless --disable-gpu --dump-dom https://www.google.com/ chrome --headless --disable-gpu --print-to-pdf https://www.google.com/ And I'm running all of these commands from the following path (the default installation path for Chrome on Windows): C:\Program Files (x86)\Google\Chrome\Application\ When I run the

How to specify browser language in Puppeteer

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 01:26:59
问题 I would like to launch a Google Chrome browser with language Spanish es using Puppeteer. I've tried puppeteer.launch(args:['--lang=es',...],...) but it didn't work. I've tried passing the environment variable LANGUAGE=es mocha puppeteer-test.js but it didn't work. I've tried using the userDataDir option and passing a folder with a Preferences file a { "intl": { "accept_languages": "es" } } but the browser Settings - Languages still don't show Spanish and neither does window.navigator

Download file through Google Chrome in headless mode

不打扰是莪最后的温柔 提交于 2019-11-29 18:07:27
I'm do me code in Cromedrive in 'normal' mode and works fine. When I change to headless mode it don't download the file. I already try the code I found alround internet, but didn't work. chrome_options = Options() chrome_options.add_argument("--headless") self.driver = webdriver.Chrome(chrome_options=chrome_options, executable_path=r'{}/chromedriver'.format(os.getcwd())) self.driver.set_window_size(1024, 768) self.driver.command_executor._commands["send_command"] = ("POST", '/session/$sessionId/chromium/send_command') params = {'cmd': 'Page.setDownloadBehavior', 'params': {'behavior': 'allow',

Chrome headless file download with Selenium in Python

微笑、不失礼 提交于 2019-11-29 10:54:20
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? 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 driver.command_executor._commands["send_command"] = ("POST", '/session/$sessionId/chromium/send_command')

How do I Specify PDF Output Path in Chrome Headless Mode

会有一股神秘感。 提交于 2019-11-29 09:26:36
问题 This page shows that you can now use chrome to generate a PDF of a webpage using the following CLI command: chrome --headless --disable-gpu --print-to-pdf https://www.chromestatus.com/ However, it does not state how to specify the output path. How do you specify the output path? 回答1: chrome --headless --disable-gpu --print-to-pdf="C:/temp/pdftest.pdf" https://www.google.com/ source: https://cs.chromium.org/chromium/src/headless/app/headless_shell.cc?type=cs&l=63 来源: https://stackoverflow.com

Debugging with headless browser

心不动则不痛 提交于 2019-11-29 07:25:14
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? There are two ways to debug. You can get Page Source and check what is different. Now when you launch a browser using Selenium, it is using the Debugging session to automate chrome. So you can't do

How do I use Headless Chrome in Chrome 60 on Windows 10?

不问归期 提交于 2019-11-29 04:33:58
问题 I've been looking at the following article about Headless Chrome: https://developers.google.com/web/updates/2017/04/headless-chrome I just upgraded Chrome on Windows 10 to version 60, but when I run either of the following commands from the command line, nothing seems to happen: chrome --headless --disable-gpu --dump-dom https://www.google.com/ chrome --headless --disable-gpu --print-to-pdf https://www.google.com/ And I'm running all of these commands from the following path (the default

chromedriver headless alerts

风格不统一 提交于 2019-11-29 02:49:59
问题 I have this issue with selenium webdriver tests with chromedriver. Although I can run tests succesfully when using Chrome browser I can't run the same tests in headless mode. I cannot handle the Js alerts. Actually when taking a screenshot it seems that the alert won't even pop-up. Alert screenshot I have tried several workarounds: 1) driver.window_handles --> No other window seems to be present 2) driver.execute_script("window.confirm = function(){return true;}") --> Nothing changed with

Puppeteer: How to handle multiple tabs?

浪子不回头ぞ 提交于 2019-11-29 01:50:29
问题 Scenario: Web form for developer app registration with two part workflow. Page 1: Fill out developer app details and click on button to create Application ID, which opens, in a new tab... Page 2: The App ID page. I need to copy the App ID from this page, then close the tab and go back to Page 1 and fill in the App ID (saved from Page 2), then submit the form. I understand basic usage - how to open Page 1 and click the button which opens Page 2 - but how do I get a handle on Page 2 when it