@@ -83,7 +83,14 @@ def capture_page_screenshot(self, filename: str = DEFAULT_FILENAME_PAGE) -> str:
83
83
84
84
If ``filename`` equals to EMBED (case insensitive), then screenshot
85
85
is embedded as Base64 image to the log.html. In this case file is not
86
- created in the filesystem.
86
+ created in the filesystem. If ``filename`` equals to BASE64 (case
87
+ insensitive), then the base64 string is returned and the screenshot
88
+ is embedded to the log. This allows one to reuse the image elsewhere
89
+ in the report.
90
+
91
+ Example:
92
+ | ${ss}= | `Capture Page Screenshot` | BASE64 |
93
+ | Set Test Message | *HTML*Test Success<p><img src="data:image/png;base64,${ss}" width="256px"> |
87
94
88
95
Starting from SeleniumLibrary 1.8, if ``filename`` contains marker
89
96
``{index}``, it will be automatically replaced with an unique running
@@ -93,9 +100,10 @@ def capture_page_screenshot(self, filename: str = DEFAULT_FILENAME_PAGE) -> str:
93
100
format string syntax].
94
101
95
102
An absolute path to the created screenshot file is returned or if
96
- ``filename`` equals to EMBED, word `EMBED` is returned.
103
+ ``filename`` equals to EMBED, word `EMBED` is returned. If ``filename``
104
+ equals to BASE64, the base64 string containing the screenshot is returned.
97
105
98
- Support for EMBED is new in SeleniumLibrary 4.2
106
+ Support for BASE64 is new in SeleniumLibrary 6.8
99
107
100
108
Examples:
101
109
| `Capture Page Screenshot` | |
@@ -147,18 +155,24 @@ def capture_element_screenshot(
147
155
See the `Locating elements` section for details about the locator
148
156
syntax.
149
157
150
- An absolute path to the created element screenshot is returned.
158
+ An absolute path to the created element screenshot is returned. If the ``filename``
159
+ equals to BASE64 (case insensitive), then the base64 string is returned in addition
160
+ to the screenshot embedded to the log. See ``Capture Page Screenshot`` for more
161
+ information.
151
162
152
163
Support for capturing the screenshot from an element has limited support
153
164
among browser vendors. Please check the browser vendor driver documentation
154
165
does the browser support capturing a screenshot from an element.
155
166
156
167
New in SeleniumLibrary 3.3. Support for EMBED is new in SeleniumLibrary 4.2.
168
+ Support for BASE64 is new in SeleniumLibrary 6.8.
157
169
158
170
Examples:
159
171
| `Capture Element Screenshot` | id:image_id | |
160
172
| `Capture Element Screenshot` | id:image_id | ${OUTPUTDIR}/id_image_id-1.png |
161
173
| `Capture Element Screenshot` | id:image_id | EMBED |
174
+ | ${ess}= | `Capture Element Screenshot` | id:image_id | BASE64 |
175
+
162
176
"""
163
177
if not self .drivers .current :
164
178
self .info (
0 commit comments