You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
It raises if you try to use single quotes in a screenshot :selector.
To Reproduce
require"bundler/inline"gemfiledosource"https://rubygems.org"gem"ferrum","0.15"gem"base64"endb=Ferrum::Browser.new(timeout: 120,headless: "new",window_size: [1920,1080])b.goto("https://en.wikipedia.org/wiki/Main_Page")b.screenshot(encoding: :base64,selector: "[aria-labelledby='firstHeading']")# Note single quotes
This raises:
/Users/zavan/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ferrum-0.15/lib/ferrum/frame/runtime.rb:138:in `handle_error': SyntaxError: missing ) after argument list (Ferrum::JavaScriptError)
from /Users/zavan/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ferrum-0.15/lib/ferrum/frame/runtime.rb:122:in `block in call'
from /Users/zavan/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ferrum-0.15/lib/ferrum/utils/attempt.rb:10:in `with_retry'
from /Users/zavan/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ferrum-0.15/lib/ferrum/frame/runtime.rb:105:in `call'
from /Users/zavan/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ferrum-0.15/lib/ferrum/frame/runtime.rb:68:in `evaluate_async'
from /Users/zavan/.asdf/installs/ruby/3.3.3/lib/ruby/3.3.0/forwardable.rb:240:in `evaluate_async'
from /Users/zavan/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ferrum-0.15/lib/ferrum/page/screenshot.rb:253:in `bounding_rect'
from /Users/zavan/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ferrum-0.15/lib/ferrum/page/screenshot.rb:230:in `area_options'
from /Users/zavan/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ferrum-0.15/lib/ferrum/page/screenshot.rb:207:in `screenshot_options'
from /Users/zavan/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ferrum-0.15/lib/ferrum/page/screenshot.rb:82:in `screenshot'
from /Users/zavan/.asdf/installs/ruby/3.3.3/lib/ruby/3.3.0/forwardable.rb:240:in `screenshot'
from screenshot.rb:26:in `<main>'
Describe the bug
It raises if you try to use single quotes in a screenshot
:selector
.To Reproduce
This raises:
Using double quotes work:
This happens because single quotes are already used to quote the selector itself here in line 255:
ferrum/lib/ferrum/page/screenshot.rb
Lines 252 to 262 in ac52ce9
Maybe
CSS.escape
can help?Expected behavior
The quoting used in the selector shouldn't matter.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: