Class: TRMNLP::Screenshot
- Inherits:
-
Object
- Object
- TRMNLP::Screenshot
- Defined in:
- lib/trmnlp/screenshot.rb
Instance Method Summary collapse
- #call(html:, width:, height:) ⇒ Object
-
#initialize(pool:) ⇒ Screenshot
constructor
A new instance of Screenshot.
Constructor Details
#initialize(pool:) ⇒ Screenshot
Returns a new instance of Screenshot.
8 9 10 |
# File 'lib/trmnlp/screenshot.rb', line 8 def initialize(pool:) @pool = pool end |
Instance Method Details
#call(html:, width:, height:) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/trmnlp/screenshot.rb', line 12 def call(html:, width:, height:) attempts = 0 begin @pool.with_driver { |driver| render(driver, html, width, height) } rescue Selenium::WebDriver::Error::TimeoutError, Selenium::WebDriver::Error::WebDriverError attempts += 1 retry if attempts <= 1 raise end end |