We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
pathlib
remote/file_detector.py
1 parent ccdbd04 commit 8ed2d9fCopy full SHA for 8ed2d9f
py/selenium/webdriver/remote/file_detector.py
@@ -15,9 +15,9 @@
15
# specific language governing permissions and limitations
16
# under the License.
17
18
-import os
19
from abc import ABCMeta
20
from abc import abstractmethod
+from pathlib import Path
21
from typing import Optional
22
23
from selenium.types import AnyKey
@@ -45,13 +45,5 @@ class LocalFileDetector(FileDetector):
45
46
def is_local_file(self, *keys: AnyKey) -> Optional[str]:
47
file_path = "".join(keys_to_typing(keys))
48
-
49
- if not file_path:
50
- return None
51
52
- try:
53
- if os.path.isfile(file_path):
54
- return file_path
55
- except Exception:
56
- pass
57
+ path = Path(file_path)
+ return file_path if path.is_file() else None
0 commit comments