@@ -83,7 +83,14 @@ def capture_page_screenshot(self, filename: str = DEFAULT_FILENAME_PAGE) -> str:
8383
8484 If ``filename`` equals to EMBED (case insensitive), then screenshot
8585 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"> |
8794
8895 Starting from SeleniumLibrary 1.8, if ``filename`` contains marker
8996 ``{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:
93100 format string syntax].
94101
95102 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.
97105
98- Support for EMBED is new in SeleniumLibrary 4.2
106+ Support for BASE64 is new in SeleniumLibrary 6.8
99107
100108 Examples:
101109 | `Capture Page Screenshot` | |
@@ -147,18 +155,24 @@ def capture_element_screenshot(
147155 See the `Locating elements` section for details about the locator
148156 syntax.
149157
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.
151162
152163 Support for capturing the screenshot from an element has limited support
153164 among browser vendors. Please check the browser vendor driver documentation
154165 does the browser support capturing a screenshot from an element.
155166
156167 New in SeleniumLibrary 3.3. Support for EMBED is new in SeleniumLibrary 4.2.
168+ Support for BASE64 is new in SeleniumLibrary 6.8.
157169
158170 Examples:
159171 | `Capture Element Screenshot` | id:image_id | |
160172 | `Capture Element Screenshot` | id:image_id | ${OUTPUTDIR}/id_image_id-1.png |
161173 | `Capture Element Screenshot` | id:image_id | EMBED |
174+ | ${ess}= | `Capture Element Screenshot` | id:image_id | BASE64 |
175+
162176 """
163177 if not self .drivers .current :
164178 self .info (
0 commit comments