New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 712981 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug

Blocked on:
issue 686608



Sign in to add a comment

Selenium -- headless isn't headless (Windows 10)

Reported by david.ha...@gmail.com, Apr 19 2017

Issue description

Chrome Version       : 59.0.3071.9 (Official Build) dev (64-bit)
URLs (if applicable) : N/A
Other browsers tested:
  Add OK or FAIL, along with the version, after other browsers where you
have tested this issue:
     Safari:
    Firefox:
         IE:

Hi, I've written a test module in python to visit a website, click on a couple of links, and then download the PDF to whose URL i've navigated,  i am using selenium with chromedriver (latest version).  it works perfectly when i use the browser in normal (visible) mode.  now i'm trying to do the same thing with the browser running in headless mode.  i initialize the browser as follows:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC
import selenium.webdriver.support.ui as ui
from selenium.webdriver.chrome.options import Options

options = webdriver.ChromeOptions()

prefs = {"download.default_directory": "D:/projects/getpdf/src/chromeTest", "plugins.always_open_pdf_externally": True,
		 "disable-extensions": True, "download.prompt_for_download": False, "download.directory_upgrade": True}
options.add_experimental_option("prefs", prefs)
options.add_experimental_option("args", ["--headless"])
options.add_argument("disable-infobars")
driver = webdriver.Chrome(chrome_options = options)

driver.get("https://www.ncbi.nlm.nih.gov/pubmed/25988229")
...

the expected result occurs -- eventually the PDF gets downloaded -- but the browser is visible, not headless, and looks and behaves exactly the same as when i omit the line
options.add_experimental_option("args", ["--headless"]).

from the docs, this appears to be the right way to start chrome in headless mode, so what am i doing wrong?

-dh


What is the expected result?

that chrome would open invisibly; the proof of its existence would be the appearance of the PDF i'm downloading.


What happens instead?

the PDF gets downloaded, so chrome is functioning properly, but it is visible, not invisible.

Please provide any additional information below. Attach a screenshot if
possible.

 
Components: Tests>WebDriver
Labels: M-59 OS-Windows
Labels: Needs-Feedback
david@, please pass the '--headless' command line flag in following manner:-

options.add_argument("headless")

Let us know how this goes. If you still reproduce the issue, please share Chromedriver verbose logs.
hi gmanikp,

i changed the headless flag line as you suggested; i've attached the
script, playWithSelenium.py.  if you run it, you should see in the "dfd"
directory (which you can reset to your local directory of choice) the log
file and a 1180 KB pdf.  the goal is to get the pdf to show up without
seeing the browser appear.  in addition to the script, i've attached the
log file i got with the --verbose argument.

when i run it, the PDF appears as expected, and the driver closes normally,
but the browser window is visible (exactly as if i'd omitted the
options.add_argument('headless') line).

please advise, and thanks.

-david haynor
Project Member

Comment 4 by sheriffbot@chromium.org, Apr 20 2017

Cc: gmanikpure@chromium.org
Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "gmanikpure@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
david@, thanks for trying out the suggestion given in comment#2. But attachments are missing. Can you please attach it again?
Blockedon: 686608
Status: Available (was: Unconfirmed)
The Windows patch for --headless hasn't quite landed yet. Please keep an eye on  bug 686608 .
hi gmanikpure,

i'm also attaching the files here.

-dh
playWithSelenium.py
1.5 KB View Download
cdLog.txt
198 KB View Download
thanks david, but as mentioned in comment#6, work is in progress for headless feature on Windows. Please follow  bug 686608  for more details.
crbug/686608 has been fixed now and --headless flag should run as expected in Windows as of M60
hi dvallet,

file downloading still doesn't work in headless mode, though [at least with
selenium/chromedriver].

-dh
Status: WontFix (was: Available)
Support for file downloading is tracked in bug 696481. Closing this, since headless support on windows should be available in M60 now.

Sign in to add a comment