Reputation: 833
Currently when I do:
Capture Page Screenshot ${filename}
Alternatively in my library:
sel = BuiltIn().get_library_instance('SeleniumLibrary')
sel.capture_page_screenshot(path)
The screenshot file gets logged into the HTML log. I'd like to capture the screenshot but the file in the log is not necessary as I'm planning to do some more actions around the screenshot (comparison against baseline.)
How can I remove the file from the HTML log or just prevent logging it when capturing the screenshot?
Upvotes: 1
Views: 322
Reputation: 386010
The underlying selenium library (the python library, not the keyword library) has a method named save_screenshot
. You can get a reference to the underlying selenium driver and call that method directly.
Here's an example of a keyword that takes a screenshot and then saves it to a file with the given filename:
*** Keywords ***
Save screenshot
[Arguments] ${filename}
${selib}= Get library instance SeleniumLibrary
Call method ${selib.driver} save_screenshot ${filename}
To save a screenshot in the file "screenshot.png" in the current working directory, you would call it like in the following example:
*** Test Cases ***
Example
Go to http://www.robotframework.org
Save screenshot screenshot.png
Upvotes: 1