What happened?
Chromedriver sometimes returns {value: null} when you GET /session/<id>/screenshot instead of returning a string. I think that's probably a chromedriver bug.
In the selenium ruby bindings, in lib/selenium/webdriver/common/takes_screenshot.rb , any NameError is treated as "driver does not support screenshots".
When nil.unpack1('m') is called (because a null value was returned from chromedriver), this is reported as "driver does not support screenshots. This makes diagnosing the actual issue significantly more difficult!
How can we reproduce the issue?
Use chromedriver
Load a page with an iframe
Switch to the iframe
Take a screenshot
Relevant log output
[53, 62] in /home/daniel/.gem/ruby/3.2.2/gems/selenium-webdriver-4.12.0/lib/selenium/webdriver/common/takes_screenshot.rb
53: when :base64
54: full_page ? full_screenshot : screenshot
55: when :png
56: as = screenshot_as(:base64, full_page: full_page)
57: debugger unless as
=> 58: as.unpack1('m')
59: else
60: raise Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
61: end
62: rescue NameError
(byebug) as
nil
(byebug) screenshot_as(:base64, full_page: full_page).length
253940
Operating System
Ubuntu
Selenium version
4.12.0 ruby
What are the browser(s) and version(s) where you see this issue?
Chrome 115
What are the browser driver(s) and version(s) where you see this issue?
Chromedriver 115
Are you using Selenium Grid?
No
What happened?
Chromedriver sometimes returns
{value: null}when you GET/session/<id>/screenshotinstead of returning a string. I think that's probably a chromedriver bug.In the selenium ruby bindings, in lib/selenium/webdriver/common/takes_screenshot.rb , any NameError is treated as "driver does not support screenshots".
When
nil.unpack1('m')is called (because a null value was returned from chromedriver), this is reported as "driver does not support screenshots. This makes diagnosing the actual issue significantly more difficult!How can we reproduce the issue?
Relevant log output
Operating System
Ubuntu
Selenium version
4.12.0 ruby
What are the browser(s) and version(s) where you see this issue?
Chrome 115
What are the browser driver(s) and version(s) where you see this issue?
Chromedriver 115
Are you using Selenium Grid?
No