playwright-python
playwright-python copied to clipboard
[Feature] More `Exception` types
Currently playwright says playwright._impl._api_types.TimeoutError or playwright._impl._api_types.Error, could you please add a lot more errors such as NavigationError, SelectorNotFoundError etc.
Use case is that I want to handle specific errors in try/except statements like so:
try:
page.click("asdf")
except SelectorNotFoundError:
print("selector not found")
As a work around for now, you can convert the thrown exception to a string and match based on its contents.
Closing for now since this is not planned in the near future.