diff --git a/py/selenium/webdriver/remote/webdriver.py b/py/selenium/webdriver/remote/webdriver.py index 6e0113cd9e4a2..6684278a0d84a 100644 --- a/py/selenium/webdriver/remote/webdriver.py +++ b/py/selenium/webdriver/remote/webdriver.py @@ -920,7 +920,7 @@ def get_screenshot_as_file(self, filename) -> bool: driver.get_screenshot_as_file('/Screenshots/foo.png') """ - if not filename.lower().endswith(".png"): + if not str(filename).lower().endswith(".png"): warnings.warn( "name used for saved screenshot does not match file " "type. It should end with a `.png` extension", UserWarning,