@@ -4592,9 +4592,9 @@ def load_cookies(self, name="cookies.txt", expiry=False):
4592
4592
Loads the page cookies from the "saved_cookies" folder.
4593
4593
Usage for setting expiry:
4594
4594
If expiry == 0 or False: Delete "expiry".
4595
+ If expiry is True: Set "expiry" to 24 hours in the future.
4595
4596
If expiry == -1 (or < 0): Do not modify "expiry".
4596
4597
If expiry > 0: Set "expiry" to expiry minutes in the future.
4597
- If expiry == True: Set "expiry" to 24 hours in the future.
4598
4598
"""
4599
4599
cookies = self.get_saved_cookies(name)
4600
4600
self.wait_for_ready_state_complete()
@@ -4606,12 +4606,12 @@ def load_cookies(self, name="cookies.txt", expiry=False):
4606
4606
cookie["domain"] = trim_origin
4607
4607
if "expiry" in cookie and (not expiry or expiry == 0):
4608
4608
del cookie["expiry"]
4609
+ elif expiry is True:
4610
+ cookie["expiry"] = int(time.time()) + 86400
4609
4611
elif isinstance(expiry, (int, float)) and expiry < 0:
4610
4612
pass
4611
4613
elif isinstance(expiry, (int, float)) and expiry > 0:
4612
4614
cookie["expiry"] = int(time.time()) + int(expiry * 60.0)
4613
- elif expiry:
4614
- cookie["expiry"] = int(time.time()) + 86400
4615
4615
self.driver.add_cookie(cookie)
4616
4616
4617
4617
def delete_all_cookies(self):
@@ -4693,9 +4693,9 @@ def add_cookie(self, cookie_dict, expiry=False):
4693
4693
self.add_cookie({'name': 'foo', 'value': 'bar', 'sameSite': 'Strict'})
4694
4694
Usage for setting expiry:
4695
4695
If expiry == 0 or False: Delete "expiry".
4696
+ If expiry is True: Set "expiry" to 24 hours in the future.
4696
4697
If expiry == -1 (or < 0): Do not modify "expiry".
4697
4698
If expiry > 0: Set "expiry" to expiry minutes in the future.
4698
- If expiry == True: Set "expiry" to 24 hours in the future.
4699
4699
"""
4700
4700
self.__check_scope()
4701
4701
self._check_browser()
@@ -4707,21 +4707,21 @@ def add_cookie(self, cookie_dict, expiry=False):
4707
4707
cookie["domain"] = trim_origin
4708
4708
if "expiry" in cookie and (not expiry or expiry == 0):
4709
4709
del cookie["expiry"]
4710
+ elif expiry is True:
4711
+ cookie["expiry"] = int(time.time()) + 86400
4710
4712
elif isinstance(expiry, (int, float)) and expiry < 0:
4711
4713
pass
4712
4714
elif isinstance(expiry, (int, float)) and expiry > 0:
4713
4715
cookie["expiry"] = int(time.time()) + int(expiry * 60.0)
4714
- elif expiry:
4715
- cookie["expiry"] = int(time.time()) + 86400
4716
4716
self.driver.add_cookie(cookie_dict)
4717
4717
4718
4718
def add_cookies(self, cookies, expiry=False):
4719
4719
"""
4720
4720
Usage for setting expiry:
4721
4721
If expiry == 0 or False: Delete "expiry".
4722
+ If expiry is True: Set "expiry" to 24 hours in the future.
4722
4723
If expiry == -1 (or < 0): Do not modify "expiry".
4723
4724
If expiry > 0: Set "expiry" to expiry minutes in the future.
4724
- If expiry == True: Set "expiry" to 24 hours in the future.
4725
4725
"""
4726
4726
self.__check_scope()
4727
4727
self._check_browser()
@@ -4733,12 +4733,12 @@ def add_cookies(self, cookies, expiry=False):
4733
4733
cookie["domain"] = trim_origin
4734
4734
if "expiry" in cookie and (not expiry or expiry == 0):
4735
4735
del cookie["expiry"]
4736
+ elif expiry is True:
4737
+ cookie["expiry"] = int(time.time()) + 86400
4736
4738
elif isinstance(expiry, (int, float)) and expiry < 0:
4737
4739
pass
4738
4740
elif isinstance(expiry, (int, float)) and expiry > 0:
4739
4741
cookie["expiry"] = int(time.time()) + int(expiry * 60.0)
4740
- elif expiry:
4741
- cookie["expiry"] = int(time.time()) + 86400
4742
4742
self.driver.add_cookie(cookie)
4743
4743
4744
4744
def __set_esc_skip(self):
0 commit comments