Module: Selenium::WebDriver::DriverExtensions::PrintsPage
- Defined in:
- rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb
Instance Method Summary collapse
-
#print_page(**options) ⇒ Object
Return a Base64 encoded Print Page as a string.
-
#save_print_page(path, **options) ⇒ Object
Save a page as a PDF to the given path.
Instance Method Details
#print_page(**options) ⇒ Object
Return a Base64 encoded Print Page as a string
50 51 52 53 54 55 |
# File 'rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb', line 50 def print_page(**) [:pageRanges] = Array(.delete(:page_ranges)) || [] [:shrinkToFit] = .delete(:shrink_to_fit) { true } @bridge.print_page() end |
#save_print_page(path, **options) ⇒ Object
Save a page as a PDF to the given path
35 36 37 38 39 40 |
# File 'rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb', line 35 def save_print_page(path, **) File.open(path, 'wb') do |file| content = Base64.decode64 print_page(**) file << content end end |