module Selenium::WebDriver::DriverExtensions::PrintsPage
Public Instance Methods
print_page(**options)
click to toggle source
Return a Base64 encoded Print Page as a string
@see w3c.github.io/webdriver/#print-page
@api public
# File lib/selenium/webdriver/common/driver_extensions/prints_page.rb, line 50 def print_page(**options) options[:pageRanges] = Array(options.delete(:page_ranges)) || [] options[:shrinkToFit] = options.delete(:shrink_to_fit) { true } @bridge.print_page(options) end
save_print_page(path, **options)
click to toggle source
Save a page as a PDF to the given path
@example Save Printed Page
driver.save_print_page('../printed_page.pdf')
@param [String] path to where the pdf should be saved
@api public
# File lib/selenium/webdriver/common/driver_extensions/prints_page.rb, line 35 def save_print_page(path, **options) File.open(path, 'wb') do |file| content = Base64.decode64 print_page(**options) file << content end end