Skip to content

Suggested Keyword: View Screenshot #57

Description

@schinckel

When debugging robot tests that use chromeheadless, I've found that more often than not I actually want to view a screenshot of what the browser is doing at the point in time when I drop into a Debug session.

This is not quite the same as just saving a screenshot, because the file should only be temporary.

Internally, I'm using something like:

    def view_screenshot(self):
        import subprocess
        import tempfile
        from robot.libraries.BuiltIn import BuiltIn

        selenium = Builtin().get_library_instance('SeleniumLibrary')
        filename = tempfile.mkstemp(suffix='.png')[1]

        subprocess.call([
            'open',
            selenium.capture_page_screenshot(filename)
        ])
        subprocess.call(['rm', filename])

Is this something you would be prepared to include? It's probably going to require a bit of tweaking (it's geared to macOS right now, which has an open command, for instance), but I'd be happy to submit a PR if you are interested.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions