Fix focus issues in operator.

This commit is contained in:
sfigato 2019-08-01 16:15:57 +02:00 committed by blallo
parent 37361da75d
commit 595d80c69c
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F

View File

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