Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for headless chrome/chromium for image diff tests #6594

Closed
mattpap opened this Issue Jul 10, 2017 · 4 comments

Comments

Projects
None yet
5 participants
@mattpap
Copy link
Contributor

mattpap commented Jul 10, 2017

At some point this should replace phantomjs in our image diff tests.

@mattpap

This comment has been minimized.

Copy link
Contributor Author

mattpap commented Oct 4, 2017

I tested on Windows, and Chrome 61 (I presume also 60) does support headless mode and works perfectly. At this point there is no real reason to stick to phantomjs. We will need conda packages for chrome, and we will be able to proceed with integration.

@normaljosh

This comment has been minimized.

Copy link
Contributor

normaljosh commented Nov 21, 2017

I was able to get bokeh working with headless chrome, on windows 10 and chrome 62. It's significantly faster to run export_png this way vs with no driver specified.

steps I took:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("start-maximized")
options.add_argument("disable-infobars")
options.add_argument("--disable-extensions")
options.add_argument('--headless')
driver = webdriver.Chrome(chrome_options=options, executable_path=r'PATH_TO_DRIVER')

from bokeh.plotting import figure, show, output_file
from bokeh.sampledata.iris import flowers
from bokeh.io import export_png

#create some bokeh figure 'p'

export_png(p, filename=r"imagepath.png",  webdriver=driver)
@eileenjkim

This comment has been minimized.

Copy link

eileenjkim commented Mar 1, 2018

[UPDATE]: Resolved my own issue. I added argument ("--windows-size=<#,#>") and just tweaked it until my export plots looked correct.

[Original Post]: Thanks @normaljosh - that script runs for me. However, it seems that the export_png using chrome takes a screenshot of the html file opened in a web browser, as opposed to what using phantomJS did - grab a picture of the whole plot. Any ideas on how to make your script pull the whole plot? A workaround is probably to minimize my html plot size so that it fits in a web browser, but would prefer to avoid that route if possible.

@bryevdv bryevdv modified the milestones: 0.12.x, 0.12.16 Mar 17, 2018

@dimab0

This comment has been minimized.

Copy link

dimab0 commented Mar 23, 2018

I've got the same problem as Eileen, with the window size being too small.

@bryevdv bryevdv modified the milestones: 0.12.16, 0.12.15 Mar 26, 2018

@bryevdv bryevdv changed the title Add support for headless chrome/chromium Add support for headless chrome/chromium for image diff tests Mar 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.