WebElement.screenshot_to_image

def screenshot_to_image(
self,
image_file: str,
timeout: int = 30
) -> None

Save target element’s screenshot to file using cdp tech. Only support for chromium webelements.

Parameters:
image_file[Required]: str
   File path to save image.
timeout: int = 30
   Timeout for the operation. The unit of parameter is seconds. Default is set to 30 seconds

Returns:
 None

Example:


from clicknium import clicknium as cc
import os,sys

file = os.path.join(os.path.abspath(sys.path[0]), "tmp.jpg")
tab = cc.chrome.open("https://clicknium.com")
web_element = tab.find_element(locator.chrome.sample)
web_element.screenshot_to_image(file, 1)

Previousexecute_js_fileNextscroll

What are your feelings
Updated on 29 August 2023