3

As per splinter docs to

Take a full view screenshot:

browser = Browser()
screenshot_path = browser.screenshot('absolute_path/your_screenshot.png', full=True)

I am using the same code but it throws

TypeError: screenshot() got an unexpected keyword argument 'full'

Here is the code -

from splinter import Browser
import time

with Browser('chrome') as browser:

url = "http://www.google.com"
browser.visit(url)
browser.fill('q', 'List of top IT firms')

button = browser.find_by_name('btnG')

button.click()

browser.screenshot('D:/sss/your_screenshot1.png', full=True)
time.sleep(3)
browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")
browser.screenshot('D:/sss/your_screenshot2.png', full=True)

Please help me here.

Thanks in advance!

Divya Arya
  • 439
  • 5
  • 22
  • Maybe you're using an older version with a different interface. What version are you using? – Kevin Aug 06 '18 at 13:14
  • splinter version - 0.8.0 and selenium version - 3.13.0 @Kevin – Divya Arya Aug 06 '18 at 13:19
  • Maybe the Browser object is being imported from the wrong module. Please provide a [mcve], including import statements. – Kevin Aug 06 '18 at 13:48
  • Please check the code part @Kevin – Divya Arya Aug 06 '18 at 13:55
  • Interesting. https://github.com/cobrateam/splinter/blob/master/splinter/driver/webdriver/__init__.py#L504 indicates that the `full` keyword should be supported by all WebDriver objects. Maybe I'm looking at the wrong class... What does `print(type(browser))` say? – Kevin Aug 06 '18 at 14:03
  • print(type(browser)) says – Divya Arya Aug 06 '18 at 14:10
  • full page screenshots are no longer possible in selenium (the library Splinter uses for browser interaction) – Corey Goldberg Aug 06 '18 at 14:14
  • But if the problem was with Selenium and not Splinter, then it's unusual that the stack trace mentions the `full` keyword at all. – Kevin Aug 06 '18 at 14:25

1 Answers1

2

I was also looking into this, and found the answer right here : https://github.com/douglasmiranda/splinter-examples/blob/master/another_examples/screenshot.py

In a nutshell : browser.driver.save_screenshot('test.png') is the way to go !

shizhen
  • 12,251
  • 9
  • 52
  • 88
Yves
  • 21
  • 2