mirror of
https://github.com/ThePhaseless/Byparr.git
synced 2025-03-15 09:50:20 +08:00
use only new click method
This commit is contained in:
parent
a3db9667a0
commit
246a052985
@ -67,30 +67,24 @@ async def bypass_cloudflare(page: webdriver.Tab):
|
|||||||
logger.info("Found challenge")
|
logger.info("Found challenge")
|
||||||
challenged = True
|
challenged = True
|
||||||
|
|
||||||
|
loaded = False
|
||||||
try:
|
try:
|
||||||
elem = await page.find("lds-ring", timeout=3)
|
elem = await page.find("lds-ring", timeout=3)
|
||||||
|
parent = elem.parent
|
||||||
|
if not isinstance(parent, Element) or parent.attributes is None:
|
||||||
|
continue
|
||||||
|
for attr in parent.attributes:
|
||||||
|
if attr == "display: none; visibility: hidden;":
|
||||||
|
loaded = True
|
||||||
|
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
logger.debug("Challenge loaded")
|
logger.debug("Challenge loaded")
|
||||||
else:
|
else:
|
||||||
logger.debug("Challenge still loading")
|
if not loaded:
|
||||||
continue
|
logger.debug("Challenge still loading")
|
||||||
|
continue
|
||||||
|
|
||||||
await page
|
await page
|
||||||
try:
|
|
||||||
elem = await page.find(
|
|
||||||
"Verify you are human by completing the action below.",
|
|
||||||
timeout=1,
|
|
||||||
)
|
|
||||||
# If challenge solves by itself
|
|
||||||
except asyncio.TimeoutError:
|
|
||||||
if page.target.title not in CHALLENGE_TITLES:
|
|
||||||
return challenged
|
|
||||||
|
|
||||||
logger.debug(msg=f"Clicking element {elem}")
|
|
||||||
if isinstance(elem, Element):
|
|
||||||
await elem.mouse_click()
|
|
||||||
continue
|
|
||||||
|
|
||||||
logger.debug("Couldn't find the title, trying other method...")
|
logger.debug("Couldn't find the title, trying other method...")
|
||||||
elem = await page.find("input")
|
elem = await page.find("input")
|
||||||
elem = elem.parent
|
elem = elem.parent
|
||||||
@ -101,6 +95,7 @@ async def bypass_cloudflare(page: webdriver.Tab):
|
|||||||
if isinstance(inner_elem, Element):
|
if isinstance(inner_elem, Element):
|
||||||
logger.debug("Clicking element")
|
logger.debug("Clicking element")
|
||||||
await inner_elem.mouse_click()
|
await inner_elem.mouse_click()
|
||||||
|
await asyncio.sleep(3)
|
||||||
else:
|
else:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Element is a string, please report this to Byparr dev"
|
"Element is a string, please report this to Byparr dev"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user