Last active
August 29, 2015 14:03
-
-
Save abotalov/19f6f07b2d9cc64f8a59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'capybara' | |
require 'benchmark' | |
html = DATA.read | |
$app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] } | |
session = Capybara::Session.new(:selenium, $app) | |
session.visit("/") | |
puts "Capybara text: #{session.all('div').map { |el| el.text.codepoints }}" # => [[97, 32, 98], [97, 32, 98], [97, 32, 98]] | |
puts "Wedbriver text: #{session.all('div').map { |el| el.native.text.codepoints }}" # => [[97, 32, 98], [97, 32, 32, 32, 32, 98], [97, 8194, 8194, 8194, 8194, 98]] | |
__END__ | |
<!doctype html> | |
<html> | |
<body> | |
<div class="space tab lf">a | |
b</div> | |
<div class="non_breaking_space">a b</div> | |
<div class="U+2001">a    b</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment