Skip to content

Commit 0fe6d91

Browse files
authored
docs: Add usage examples for screen recording methods (#1290)
Adds clear usage examples to the docstrings of `start_recording_screen` and `stop_recording_screen` methods in `appium/webdriver/extensions/screen_record.py` demonstrating how to start a recording, stop it, and decode the resulting base64 output into an MP4 file.
1 parent 6d775af commit 0fe6d91

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

appium/webdriver/extensions/screen_record.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ def start_recording_screen(self, **options: Any) -> bytes | str:
151151
Possible values are 'ultrafast', 'superfast', 'veryfast'(default), 'faster', 'fast', 'medium', 'slow',
152152
'slower', 'veryslow'
153153
154+
Usage:
155+
driver.start_recording_screen()
156+
154157
Returns:
155158
bytes: Base-64 encoded content of the recorded media
156159
if `stop_recording_screen` isn't called after previous `start_recording_screen`.
@@ -184,6 +187,12 @@ def stop_recording_screen(self, **options: Any) -> bytes:
184187
the same key as `fileFieldName` then it is going to be ignored. (Since Appium 1.18.0)
185188
headers (dict): [multipart/form-data requests] Headers mapping (Since Appium 1.18.0)
186189
190+
Usage:
191+
payload = driver.stop_recording_screen()
192+
with open('media.mp4', "wb") as fd:
193+
import base64
194+
fd.write(base64.b64decode(payload))
195+
187196
Returns:
188197
bytes: Base-64 encoded content of the recorded media file or an empty string
189198
if the file has been successfully uploaded to a remote location

0 commit comments

Comments
 (0)