Skip to content

Keyword capture_page_screenshot fails when using Remote WebDriver #43

Closed

Description

@ombre42

When using a Remote WebDriver, call keyword Capture Page Screenshot. Result:
FAIL AttributeError: 'WebDriver' object has no attribute 'save_screenshot'

The remote driver in the Selenium Python bindings defines a method called get_screenshot_as_file instead of save_screenshot, but they perform the same action and have the same signature.

A simple workaround for this:
on Line 27 of keywords/_screenshot.py,
replace:
self._current_browser().save_screenshot(path)
with:
if hasattr(self._current_browser(), 'get_screenshot_as_file'):
self._current_browser().get_screenshot_as_file(path)
else:
self._current_browser().save_screenshot(path)

Activity

  1. ombre42 commented on May 5, 2012

    @ombre42
    ContributorAuthor

    fixed in korda's fork- korda@0c52e07
    thank you and sorry I didn't use GFM markup

  2. adwu73 commented on Jul 6, 2012

    @adwu73
    Contributor

    I have reproduced the issue, and tested the fix. It works. can someone help to merge this into the fork? It seems this fix is not in 1.0.1 yet?

  3. hbmartin commented on Jul 19, 2012

    @hbmartin

    I am also curious about the status of this fix, especially since it seems like rtomac hasn't been active in over a month.

  4. peritus commented on Jul 23, 2012

    @peritus
    Contributor

    I can confirm that @ombre42's patch fixes the issue (and i get screenshots in reports)

  5. peritus commented on Jul 23, 2012

    @peritus
    Contributor

    Created a pull request that includes @korda's patch for easy merging:

    #80

  6. emanlove commented on Sep 25, 2012

    @emanlove
    Member

    Merged with #80. This fix will be in the Selenium2Library 1.1 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions