rubycdp / ferrum

Headless Chrome Ruby API
https://ferrum.rubycdp.com
MIT License
1.7k stars 122 forks source link

Screenshot in headless mode, no image, no css #318

Closed zsan closed 1 year ago

zsan commented 1 year ago

Hello,

So i call screenshot's method in both mode (headless and non headless) and both gave me a different result. For example, i can't see any image in headless's mode.

was that intentional?

browser = Ferrum::Browser.new(headless: true)
browser.goto("https://www.example.gov.xtc/en/apply/")
browser.screenshot(path: "shot.png")
Screenshot 2022-12-06 at 15 53 23
zsan commented 1 year ago

Just FYI,

I switched to capybara get the screnshot of the page and i got the same result, so i think it's not ferrum's issue

zsan commented 1 year ago

Just to share,

I think my issue is related to the page/site that i want to fetch and i believe they put some restriction in their application.

Screenshot is looks good If i put this header

browser.headers.set({"Accept-Language" => "fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7"})