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
Closed

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

mattpap opened this issue Jul 10, 2017 · 4 comments

Comments

@mattpap
Copy link
Contributor

@mattpap mattpap commented Jul 10, 2017

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

@mattpap mattpap added this to the 0.12.7 milestone Jul 10, 2017
@mattpap mattpap self-assigned this Jul 10, 2017
@bryevdv bryevdv removed this from the 0.12.7 milestone Aug 21, 2017
@bryevdv bryevdv added this to the 0.12.8 milestone Aug 21, 2017
@bryevdv bryevdv added this to the 0.12.8 milestone Aug 21, 2017
@bryevdv bryevdv removed this from the 0.12.7 milestone Aug 21, 2017
@mattpap
Copy link
Contributor Author

@mattpap 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.

Loading

@normaljosh
Copy link
Contributor

@normaljosh 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)

Loading

@eileenjkim
Copy link

@eileenjkim 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.

Loading

@bryevdv bryevdv removed this from the 0.12.x milestone Mar 17, 2018
@bryevdv bryevdv added this to the 0.12.16 milestone Mar 17, 2018
@dimab0
Copy link

@dimab0 dimab0 commented Mar 23, 2018

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

Loading

@bryevdv bryevdv removed this from the 0.12.16 milestone Mar 26, 2018
@bryevdv bryevdv added this to the 0.12.15 milestone 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

5 participants