try to avoid thread exception
This commit is contained in:
+6
-3
@@ -33,6 +33,8 @@ class CommandorPage:
|
||||
def _run(self, e: threading.Event, proxy, contact: ContactPojo, on_ready_for_otp, on_success):
|
||||
self.contact = contact
|
||||
self.on_success_listener = on_success
|
||||
# reset otp_value to None
|
||||
self.otp_value = None
|
||||
with sync_playwright() as pwright:
|
||||
firefox_user_agents = filter(lambda user_agent: "firefox" in user_agent.lower(), user_agent_list)
|
||||
firefox_user_agents_list = list(firefox_user_agents)
|
||||
@@ -69,9 +71,9 @@ class CommandorPage:
|
||||
logging.info('event set: %s', event_is_set)
|
||||
if self.otp_value:
|
||||
self.fill_otp(self.otp_value)
|
||||
self.clickOnValidBtn()
|
||||
otp_sent = self.page.locator(MESSAGE_FIELD_CLASS)
|
||||
otp_sent.wait_for(state='visible')
|
||||
self.clickOnValidBtn()
|
||||
otp_sent = self.page.locator(MESSAGE_FIELD_CLASS)
|
||||
otp_sent.wait_for(state='visible')
|
||||
message = self.page.content()
|
||||
# print("message is:" + message)
|
||||
time.sleep(2)
|
||||
@@ -97,6 +99,7 @@ class CommandorPage:
|
||||
return self.page.content()
|
||||
except Exception as error:
|
||||
self.logger.exception(error)
|
||||
self.browser.close()
|
||||
return None
|
||||
|
||||
def start_page(self, proxy, contact: ContactPojo, on_ready_for_otp, on_sucess) -> threading.Event:
|
||||
|
||||
Reference in New Issue
Block a user