Repository navigation
Conversation
The start_recording_screen and stop_recording_screen docstrings named options that the drivers do not read, and the return annotations did not match what the server sends. The response value is decoded from JSON, so it is never bytes. Both methods return the base64 string as a str, and on Windows and macOS start_recording_screen returns None. The annotations are now `str | None` for start and `str` for stop. There is no runtime change. Docstring fixes: - forcedRestart is renamed to forceRestart, the key read by the Android, XCUITest, Windows and Mac2 drivers. The Windows and macOS default of True is documented. - captureClick is renamed to captureClicks, as read by the Windows and Mac2 drivers. - videoFilters is marked iOS only. The Windows and Mac2 drivers read videoFilter, which now has its own entry and table row. - bugReport is a boolean in the Android driver, not a string. - The timeLimit maximums are those enforced by the drivers: 1800 s on Android and 4200 s on iOS. Mac2 enforces no maximum, so the 10000 s line is removed. The 600 s default also applies to Windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
start_recording_screen()is annotated-> bytes | strandstop_recording_screen()is annotated-> bytes. Both return the responsevalue, which is decoded from JSON, so it can never bebytes. The drivers return the base64 video as a string. On Windows and macOS,start_recording_screen()returns nothing, which the Appium server sends asnull.With the old annotations, mypy accepts
driver.stop_recording_screen().decode(), which raisesAttributeErrorat runtime.Several documented keyword arguments also differ from the keys the drivers read:
forcedRestart. All drivers readforceRestart.captureClick. The Windows and Mac2 drivers readcaptureClicks.videoFiltersfor iOS, Windows and macOS. Only XCUITest readsvideoFilters; Windows and Mac2 readvideoFilter. The table at the top listedvideoFilterfor all three.bugReportasstr. The Android driver types it asboolean.timeLimitis 3 minutes on Android and 10 minutes on iOS. The drivers allow 1800 s and 4200 s. It also says macOS allows up to 10000 s, but Mac2 enforces no maximum.I checked each point against the driver source:
AndroidDriver):appium-android-driver/lib/commands/recordscreen.tsreadsforceRestart, setsMAX_TIME_SEC = 60 * 30and returnsPromise<string>.lib/commands/types.tshasbugReport?: boolean.appium-xcuitest-driver/lib/commands/recordscreen.tsreadsforceRestartandvideoFilters, setsMAX_RECORDING_TIME_SEC = 4200and returnsPromise<string>.appium-windows-driver/lib/commands/record-screen.tsreadsvideoFilter,captureClicksandforceRestart(defaulttrue), sets a 600 s default and returnsPromise<void>fromstartRecordingScreen.appium-mac2-driver/lib/commands/record-screen.tsreads the same keys as Windows, has no maximum and returnsPromise<void>fromstartRecordingScreen.undefinedresult intonull:formatResponseValueinpackages/base-driver/lib/protocol/helpers.ts.Fix
start_recording_screen()as-> str | Noneandstop_recording_screen()as-> str, and update theReturns:sections to match.forcedRestarttoforceRestartandcaptureClicktocaptureClicks. Note that Windows and macOS defaultforceRestarttoTrue.videoFiltersas iOS only, and add avideoFilterentry and table row for Windows and macOS.bugReportasbool.timeLimitmaximums and remove the macOS maximum.There is no runtime change. The
stop_recording_screenedits do not touch the Usage block, so this merges cleanly with #1334.Behaviour change: type-checker results change. Code that treats either result as
bytesis now flagged, and code that uses the result ofstart_recording_screen()without handlingNoneis flagged too.Tests
master, mypy revealsbytes | strforstart_recording_screen()andbytesforstop_recording_screen(), and acceptsdriver.stop_recording_screen().decode(). With this change it revealsstr | Noneandstr, and reports"str" has no attribute "decode".strfrom stop andNonefrom start.ruff check,ruff format --check,mypy appiumand the full unit test suite pass.🤖 Generated with Claude Code