MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / save_screenshot

Method save_screenshot

py/selenium/webdriver/remote/webdriver.py:1084–1097  ·  view source on GitHub ↗

Save a screenshot of the current window to a PNG image file. Returns: False if there is any IOError, else returns True. Use full paths in your filename. Args: filename: The full path you wish to save your screenshot to. This should end with a

(self, filename)

Source from the content-addressed store, hash-verified

1082 return True
1083
1084 def save_screenshot(self, filename) -> bool:
1085 """Save a screenshot of the current window to a PNG image file.
1086
1087 Returns:
1088 False if there is any IOError, else returns True. Use full paths in your filename.
1089
1090 Args:
1091 filename: The full path you wish to save your screenshot to. This
1092 should end with a `.png` extension.
1093
1094 Example:
1095 `driver.save_screenshot("./screenshots/foo.png")`
1096 """
1097 return self.get_screenshot_as_file(filename)
1098
1099 def get_screenshot_as_png(self) -> bytes:
1100 """Gets the screenshot of the current window as a binary data.

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected