diff --git a/bot_z/operator.py b/bot_z/operator.py index 77d3d6f..7a4571a 100644 --- a/bot_z/operator.py +++ b/bot_z/operator.py @@ -121,6 +121,7 @@ class Operator(wd.Firefox): self.profile.set_preference("datareporting.policy.dataSubmissionEnabled", False) self.profile.set_preference("datareporting.healthreport.service.enabled", False) self.profile.set_preference("datareporting.healthreport.uploadEnabled", False) + self.profile.set_preference("dom.webnotifications.enabled", False) self.opts = wd.firefox.options.Options() self.opts.headless = headless @@ -289,8 +290,10 @@ class Operator(wd.Firefox): tuple(i.strip() for i in data if i.strip()) ) except NoSuchElementException: - return [] - return result + result = [] + finally: + self.switch_to_default_content() + return result # type: ignore @property def checked_in(self) -> bool: @@ -321,6 +324,7 @@ class Operator(wd.Firefox): self._switch_to_container() enter_butt = self.find_element_by_xpath('//input[@value="Entrata"]') enter_butt.click() + self.switch_to_default_content() @safely(RETRIES) def check_out(self, force: bool = False) -> None: @@ -337,6 +341,7 @@ class Operator(wd.Firefox): self._switch_to_container() exit_butt = self.find_element_by_xpath('//input[@value="Uscita"]') exit_butt.click() + self.switch_to_default_content() def __del__(self) -> None: self.quit()