Skip to content

Commit ca32031

Browse files
committed
[py]: Fix issue with LocalFileDetector returning the path for files that do not exist
1 parent 95d6217 commit ca32031

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

py/selenium/webdriver/remote/file_detector.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class LocalFileDetector(FileDetector):
4646

4747
def is_local_file(self, *keys: AnyKey) -> Optional[str]:
4848
file_path = "".join(keys_to_typing(keys))
49+
4950
with suppress(OSError):
50-
_ = Path(file_path).is_file()
51-
return file_path
51+
if Path(file_path).is_file():
52+
return file_path

0 commit comments

Comments
 (0)