Module: Selenium::WebDriver::DriverExtensions::PrintsPage
Relationships & Source Files | |
Defined in: | rb/lib/selenium/webdriver/common/driver_extensions/prints_page.rb |
Instance Method Summary
-
#print_page(**options)
Return a Base64 encoded Print Page as a string.
-
#save_print_page(path, **options)
Save a page as a PDF to the given path.
Instance Method Details
#print_page(**options)
Return a Base64 encoded Print Page as a string
# 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)
Save a page as a PDF to the given path
# 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