File tree Expand file tree Collapse file tree 2 files changed +91
-0
lines changed Expand file tree Collapse file tree 2 files changed +91
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ title : SaveScreenshot
3+ parent : API
4+ ---
5+
6+ # API documentation
7+
8+ # SaveScreenshot(element:fileName: directory )
9+
10+
11+ Takes a screenshot of an element on the screen or the whole screen, and saves the screenshot as a PNG to a file.
12+
13+
14+ ``` swift
15+ func SaveScreenshot (
16+ element : UIElement? = nil ,
17+ fileName : String ? = nil ,
18+ directory : String ? = nil
19+ )
20+ ```
21+
22+ ## Parameters
23+
24+ ### element
25+ If provided, limit the screenshot to the frame of the element. Default is the whole screen.
26+
27+ ### fileName
28+ Name for the image name, default is “simularSavedImage.png”.
29+
30+ ### directory
31+ Directory to save the image, default at desktop.
32+
33+
34+ ## Return Value
35+
36+ None
37+
38+
39+ ## Discussion
40+
41+ Examples:
42+
43+ - Instruction: Save screenshot of whole screen to screenshot.png
44+ ``` swift
45+ SaveScreenshot (fileName : " screenshot.png" )
46+ ```
47+ - Instruction: Screenshot the group element and save to clipboard
48+ ``` swift
49+ SaveScreenshot (element : group)
50+ ```
51+ - Instruction: Screenshot the table element and save to /User/path/to/screenshot/
52+ ``` swift
53+ SaveScreenshot (element : table, directory : " /User/path/to/screenshot/" )
54+ ```
55+
56+
Original file line number Diff line number Diff line change 1+
2+ # ScreenshotToClipboard(element)
3+
4+
5+ Take a screenshot of an element or the current page and save it to the system clipboard
6+
7+
8+ ``` swift
9+ func ScreenshotToClipboard (element : UIElement? = nil )
10+ ```
11+
12+ ## Parameters
13+
14+ ### element
15+ If provided, limit the screenshot to the frame of the element. Default is the whole screen.
16+
17+
18+ ## Return Value
19+
20+ None
21+
22+
23+ ## Discussion
24+
25+ Examples:
26+
27+ - Instruction: take screenshot and save to clipboard
28+ ``` swift
29+ ScreenshotToClipboard ()
30+ ```
31+ - Instruction: get the table element on the page, save a screenshot of it to clipboard
32+ ``` swift
33+ var elements = GetElements (elementRoles : [" table" ])
34+ ScreenshotToClipboard (element : elements[0 ])
35+ ```
You can’t perform that action at this time.
0 commit comments