Recently I switched to headless chrome in my rspec tests. After the move all my tests which interact with jstree element started to fail. Below is the smallest code which allow to reproduce the bug:
There are dependencies in the Gemfile:
# Gemfile
gem 'capybara', '2.18.0'
gem 'selenium-webdriver', '3.141.0'
It is the simple page which renders jstree:
# jstree.html
<!doctype html>
<html>
<head>
<script src="https://rawgit.com/jquery/jquery/1.12.4/dist/jquery.min.js"></script>
<script src="https://rawgit.com/vakata/jstree/3.3.7/dist/jstree.min.js"></script>
<link href="https://rawgit.com/vakata/jstree/3.3.7/dist/themes/default/style.min.css" rel="stylesheet"/>
</head>
<body>
<h1>This is a list:</h1>
<ul id="tree"></ul>
<script>
$('#tree').jstree({
core: {
data: [{ "id": 1, "state": {}, "text": "Example", "parent": "#" }]
}
});
</script>
</body>
</html>
There is a ruby script to open the page with Capybara and save page screenshot:
# script.rb
require 'capybara'
require 'selenium-webdriver'
Capybara.register_driver :chrome do |app|
options = ::Selenium::WebDriver::Chrome::Options.new(
args: %w[headless no-sandbox disable-dev-shm-usage window-size=1280,800])
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
end
Capybara.default_driver = :chrome
Capybara.app = Rack::File.new File.expand_path('../', __FILE__)
include Capybara::DSL
visit '/jstree.html'
page.save_and_open_screenshot
When I run bundle exec ruby script.rb and then open the screenshot I see the following:
but when I open jstree.html in my chrome browser I see normal tree:
When I add output browser console messages to the end of the script
puts page.driver.browser.manage.logs.get(type)
and rerun bundle exec ruby script.rb I get
SEVERE 2018-12-27 16:24:23 +0300: blob:http://127.0.0.1:49346/26695642-8b26-494b-a142-54a515db6512 - Failed to load resource: net::ERR_UNKNOWN_URL_SCHEME
I am using chrome v71 and chromedriver v2.45
Does anybody have any idea what is going on there? How can I fix this issue?

