YusukeIwaki / puppeteer-ruby

A Ruby port of Puppeteer
Apache License 2.0
284 stars 41 forks source link

### Step To Reproduce / Observed behavior #330

Closed thongao1302 closed 4 months ago

thongao1302 commented 4 months ago

Step To Reproduce / Observed behavior

class YahooFinanceScrapper
  def initialize(symbol)
    @symbol = symbol
    @base_url = "https://finance.yahoo.com/quote/"
  end

  def parse
    Puppeteer.launch(headless: true) do |browser|
      page = browser.pages.first || browser.new_page
      page.viewport = Puppeteer::Viewport.new(width: 1280, height: 800)
      page.goto(@base_url + @symbol, wait_until: 'domcontentloaded')

      byebug

      h1 = page.query_selector("div#quote-header-info h1")
    end
  end
end

When running page.query_selector("div#quote-header-info h1") or page.query_selector("body") I'm getting *** RuntimeError Exception: Bug of puppeteer-ruby...

Expected behavior

Retrieve the element

Environment

Development

Paste the output of ruby --version: ruby 3.2.1

Originally posted by @siba2893 in https://github.com/YusukeIwaki/puppeteer-ruby/issues/322