Take screenshot #
Since these screenshots are uploaded only after selenium script has fully exited, screenshots could be lost if test was aborted early or has failed.
def take_screenshot(driver: TestUIDriver, file_name: str) -> None
file_name parameter specifies name of the file when it will be saved. Name
should include the desired file extension, it’s recommended by Selenium to use
.png to avoid warning logs.
def test(driver): # Example of taking browser screenshot driver.navigate_to("https://google.com") e(driver, "css", "body").wait_until_visible(seconds=10) take_screenshot(driver, "screenshot.png")
Screenshot creation is impossible in some cases, for example, when an alert is open.