Feature request: support for Chrome headless
lordgordon opened this issue · comments
Hi,
There is any plan to add Chrome headless [1] support? Having a real headless browser like Chrome could help a lot to keep our wraith tests up-to-date with new HTML\JS\CSS features.
Also consider that PhantomJS developer stepped down [2]. This could stall PhantomJS development.
Thanks,
Nicholas
References:
[1] https://www.chromestatus.com/features/5678767817097216
[2] https://groups.google.com/forum/#!topic/phantomjs/9aI5d-LDuNE
Very useful tutorial with example on how to capture screenshots with Chrome headless: https://developers.google.com/web/updates/2017/04/headless-chrome
Also useful: https://medium.com/@dschnr/using-headless-chrome-as-an-automated-screenshot-tool-4b07dffba79a
+1 For this, I'm considering using wraith but am unsure about the future-proofness if it's not compatible with headless chrome.
+1 Really looking forward to a headless Chrome Integration
+1 Please add headless Chrome Integration, because current PhantomJS had very outdated CSS support! Thanks!
Hi!
I managed to add partial and straightforward support for headless Chrome. Please go ahead and test my solution: saulirajala@988b705
Some notices about my solution:
- Same config-file works as with PhantomJS. Just change the browser to chrome
- Executing JavaScript-files before capture is not supported, so remember to disable all before_capture hooks.
- Supports history-mode and both options for resize_or_reload-setting
- Works only with Mac
- Assumes that you have Chrome 59 with build-in support for headless execution and the path of the Chrome is /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
You can test the solution by overwriting the files of your Wraith. In my computer they are located in /usr/local/lib/ruby/gems/2.3.0/gems/wraith-4.0.1
Hey there, I was having some issues integrating the posted solution on OS X and I also wanted to run this as part of our CI
I made a patch here with Chrome support which has JS before capture support, and works with Chrome on any OS. It has capabilities of full screen screenshots as well as selector only screenshots.
GitHub Fork & Branch: https://github.com/shmargum/wraith/tree/chromedriver
This relies on Chrome, which you already probably have installed if you are reading this.
This issue can be closed since the Chrome support has been merged.
Chrome support seems to work by using browser: "chrome"
. However, aborting wraith during processing isn't as smooth as it is with phantomjs. Lots of errors coming from this trigger.
@saulirajala @shmargum Guys how did you approach logging in scripts? I'm blocked as the before_capture hooks do not work for me. This is what I use:
document.getElementById('Email').value = 'example@domain.com';
document.getElementById('Next').click();
I'm getting an error that the document unloaded when waiting for the click() function result. Any ideas how to do this? I might be able to force an auth cookie to the session but unsure how?
@saulirajala @shmargum Guys how did you approach logging in scripts? I'm blocked as the before_capture hooks do not work for me. This is what I use:
document.getElementById('Email').value = 'example@domain.com'; document.getElementById('Next').click();
I'm getting an error that the document unloaded when waiting for the click() function result. Any ideas how to do this? I might be able to force an auth cookie to the session but unsure how?
Still an issue
Is the original request still an issue, or can this be closed?