remove stealth_sync
This commit is contained in:
@@ -7,7 +7,6 @@ import time
|
||||
import traceback
|
||||
from typing import Union
|
||||
|
||||
from playwright_stealth import stealth_sync
|
||||
import requests
|
||||
|
||||
from src import params, definitions
|
||||
@@ -139,7 +138,7 @@ class CommandorPage:
|
||||
userAgent = device['user_agent']
|
||||
self.logger.info("user_agent is " + userAgent)
|
||||
# context = self.browser.new_context(**simulated_mobile, locale='fr-FR')
|
||||
context = self.browser.new_context(**device, locale='en-US')
|
||||
context = self.browser.new_context(**device, locale='en-GB, en-US')
|
||||
else:
|
||||
if use_proxy:
|
||||
self.browser = pwright.firefox.launch(headless=self.headless, timeout=PAGE_TIMEOUT, proxy=proxy)
|
||||
@@ -170,7 +169,7 @@ class CommandorPage:
|
||||
}});
|
||||
}
|
||||
""")
|
||||
stealth_sync(self.page)
|
||||
# stealth_sync(self.page)
|
||||
self.page.on("load", self._on_page_loaded)
|
||||
self.page.on("response", self.handle_response)
|
||||
self.page.goto(RDV_URL, timeout=PAGE_TIMEOUT)
|
||||
@@ -197,7 +196,6 @@ class CommandorPage:
|
||||
return True
|
||||
|
||||
def _on_page_loaded(self):
|
||||
# time.sleep(40000)
|
||||
self.logger.info("页面加载完毕")
|
||||
self.logger.info("url is " + self.page.url)
|
||||
captcha_url = "geo.captcha-delivery.com/captcha"
|
||||
@@ -274,10 +272,7 @@ class CommandorPage:
|
||||
print("audio_button not found")
|
||||
return False
|
||||
|
||||
# self.page.evaluate("""{
|
||||
# let surname = document.getElementById('captcha__audio__button');
|
||||
# surname.click();}
|
||||
# """)
|
||||
|
||||
|
||||
def get_errors(self):
|
||||
# send error result
|
||||
@@ -403,7 +398,7 @@ class CommandorPage:
|
||||
self.logger.info("will click on valid btn")
|
||||
self.clickOnValidBtn()
|
||||
# wait for 20s
|
||||
time.sleep(20)
|
||||
time.sleep(10 + get_random_wait_time())
|
||||
if not self.is_finished:
|
||||
if not self.is_captcha_in_error:
|
||||
self.clickOnValidBtn()
|
||||
|
||||
Reference in New Issue
Block a user