Skip to content

Commit

Permalink
Use raise from syntax in browser.py (#1241)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsfehler committed Feb 15, 2024
1 parent b43a42f commit dc3ae86
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions splinter/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ def get_driver(driver, retry_count=3, config=None, *args, **kwargs):
raise err


def Browser(
def Browser( # NOQA: N802
driver_name: str = "firefox",
retry_count: int = 3,
config=None,
*args,
**kwargs,
): # NOQA: N802
):
"""Get a new driver instance.
Extra arguments will be sent to the driver instance.
Expand All @@ -121,8 +121,8 @@ def Browser(

try:
driver = _DRIVERS[driver_name]
except KeyError:
raise DriverNotFoundError(f"{driver_name} is not a recognized driver.")
except KeyError as err:
raise DriverNotFoundError(f"{driver_name} is not a recognized driver.") from err

if driver is None:
raise DriverNotFoundError(f"Driver for {driver_name} was not found.")
Expand Down

0 comments on commit dc3ae86

Please sign in to comment.