robotframework-debuglibrary
robotframework-debuglibrary copied to clipboard
Suggested Keyword: View Screenshot
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.
I think this feature would be very helpful to users. Contributions are welcome.