[Feature]: support passing timedelta
objects to functions that take a timeout
argument
#2600
Labels
timedelta
objects to functions that take a timeout
argument
#2600
🚀 Feature Request
it would be nice if playwright allowed you to pass a
datetime.timedelta
object to functions that take timeouts, as it more clearly describes the unit of time being used.Example
Motivation
preventing mistakes
currently, it's easy to accidentally misuse the
timeout
argument for example if the user incorrectly assumes it refers to seconds instead of milliseconds:(yes i know you should never use
time.sleep
with playwright. this example is just to illustrate that there are builtin functions that take seconds instead of milliseconds, which makes it more likely that a user could incorrectly assume that playwright does the same)improving readability
it can also make code that waits for longer amounts of time look cleaner. currently you're forced to either write the literal number of milliseconds which is often difficult to read, or split it up into factors representing each unit:
both of these are less reradable than using a
timedelta
:The text was updated successfully, but these errors were encountered: