Skip to content

Commit 96e5d9a

Browse files
[py] Handle when timeout is 0 and not treat as Boolean
1 parent 4c73a3c commit 96e5d9a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

py/selenium/webdriver/common/timeouts.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class Timeouts(object):
2020

21-
def __init__(self, implicit_wait=None, page_load=None, script=None):
21+
def __init__(self, implicit_wait=0, page_load=0, script=0):
2222
"""
2323
Create a new Timeout object.
2424
@@ -77,11 +77,10 @@ def script(self, _script):
7777
self._script = self._convert(_script)
7878

7979
def _convert(self, timeout):
80-
if timeout:
81-
if isinstance(timeout, (int, float)):
82-
return int(float(timeout) * 1000)
83-
else:
84-
raise TypeError("Timeouts can only be an int or a float")
80+
if isinstance(timeout, (int, float)):
81+
return int(float(timeout) * 1000)
82+
else:
83+
raise TypeError("Timeouts can only be an int or a float")
8584

8685
def _to_json(self):
8786
timeouts = {}

0 commit comments

Comments
 (0)