Skip to content

Commit

Permalink
Moved token value check
Browse files Browse the repository at this point in the history
  • Loading branch information
Xewdy444 committed Nov 29, 2023
1 parent 8677664 commit 404bd20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions playwright_recaptcha/recaptchav2/async_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,9 +549,6 @@ async def _solve_audio_challenge(self, recaptcha_box: AsyncRecaptchaBox) -> None

await self._submit_audio_text(recaptcha_box, text)

while self._token is None:
await self._page.wait_for_timeout(250)

def close(self) -> None:
"""Remove the response listener."""
try:
Expand Down Expand Up @@ -672,6 +669,9 @@ async def solve_recaptcha(
or not await recaptcha_box.challenge_is_visible()
or await recaptcha_box.challenge_is_solved()
):
while self._token is None:
await self._page.wait_for_timeout(250)

return self._token

if not image_challenge:
Expand Down
6 changes: 3 additions & 3 deletions playwright_recaptcha/recaptchav2/sync_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,6 @@ def _solve_audio_challenge(self, recaptcha_box: SyncRecaptchaBox) -> None:

self._submit_audio_text(recaptcha_box, text)

while self._token is None:
self._page.wait_for_timeout(250)

def close(self) -> None:
"""Remove the response listener."""
try:
Expand Down Expand Up @@ -605,6 +602,9 @@ def solve_recaptcha(
or not recaptcha_box.challenge_is_visible()
or recaptcha_box.challenge_is_solved()
):
while self._token is None:
self._page.wait_for_timeout(250)

return self._token

if not image_challenge:
Expand Down

0 comments on commit 404bd20

Please sign in to comment.