Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headless new gives Ferrum::NoSuchPageError on screenshot #404

Closed
phlegx opened this issue Sep 22, 2023 · 2 comments
Closed

Headless new gives Ferrum::NoSuchPageError on screenshot #404

phlegx opened this issue Sep 22, 2023 · 2 comments

Comments

@phlegx
Copy link

phlegx commented Sep 22, 2023

HI there.

with latest ferrum 0.14 when we try the new flag for headless we frequently get an error on image/screenshot creation

Ferrum::NoSuchPageError

This is the part of the code where it happens

    out = nil
    browser.create_page() do |page|
      page.go_to(absolute_internal_path_to_image.gsub("'", "\\\\'"))
      out = if page.network.status.between?(200, 226)
              page.screenshot(quality:  AC['uploaders']['instant']['quality'],
                              format:   AC['uploaders']['instant']['file_format'],
                              encoding: :binary)
            else
              logger.info "  [error #{browser.network.status}] Ferrum browser bad status!"
            end
      page.close
    end

The browser now we initialize like that:

  def initialize
    @browser = Ferrum::Browser.new(browser_options: { 'headless':               'new',
                                                      'no-sandbox':             nil,
                                                      'disable-setuid-sandbox': nil,
                                                      'disable-dev-shm-usage':  nil },
                                   window_size:     [AC['uploaders']['instant']['width'],
                                                     AC['uploaders']['instant']['height']])
  end

With 0.13 version and headless to true this was working like a charm.

Any ideas what might causing that?

@phlegx phlegx changed the title Headless new gives Ferrum::NoSuchPageError Headless new gives Ferrum::NoSuchPageError on screenshot Sep 22, 2023
@erickguan
Copy link
Contributor

Can it be page is loading something more? If you wait a few 50ms-500ms before screenshot, does it get better?

@route
Copy link
Member

route commented Nov 10, 2023

For this I need debug mode turned on and logs, run with FERRUM_DEBUG=true and attach logs or send them privately and I reopen.

@route route closed this as completed Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants