pydoll icon indicating copy to clipboard operation
pydoll copied to clipboard

[Feature Request]: Make it work when website has a delay before loading captcha

Open Snewmy opened this issue 7 months ago • 11 comments

Checklist before requesting

  • [x] I have searched for similar feature requests and didn't find a duplicate.
  • [x] I have checked the documentation to confirm this feature doesn't already exist.

Problem Statement

When a website has a delay before loading the cloudflare element, the check/solvers do not work.

Proposed Solution

Not sure

Alternatives Considered

No response

Additional Context

Cannot make it work on this site https://www.planetminecraft.com/account/sign_in/

Importance

Critical (blocking my usage)

Contribution

None

Snewmy avatar Apr 06 '25 00:04 Snewmy

hi @Snewmy, you can pass a timeout parameter to the context manager

thalissonvs avatar Apr 06 '25 00:04 thalissonvs

hi @Snewmy, you can pass a timeout parameter to the context manager

Hi Thalissonvs, I had tried that but with no luck. Does this mean the website might be doing something differently?

Snewmy avatar Apr 06 '25 00:04 Snewmy

I'm sorry, I just checked the website. I'll work on that, thanks for reporting! I see the issue now

thalissonvs avatar Apr 06 '25 00:04 thalissonvs

I'm sorry, I just checked the website. I'll work on that, thanks for reporting! I see the issue now

No worries. Sorry for my lack of knowledge in this area. I am probably wrong about what is making it not work, but just right about it not working on that certain site. Thanks for the quick support!

Snewmy avatar Apr 06 '25 00:04 Snewmy

Do you know how I could manually solve that captcha? I cant seem to have any luck with looking for the iframe, or even the element directly.

Snewmy avatar Apr 06 '25 01:04 Snewmy

you can click on the div containing the iframe, just add a x_offset on the click method

thalissonvs avatar Apr 06 '25 01:04 thalissonvs

you can click on the div containing the iframe, just add a x_offset on the click method

i tried from -175x offset, to now -60x offset, going down in jumps of 5, with no luck yet. every click gives an error. it says the div is 350x68.

Image

Image

Snewmy avatar Apr 06 '25 02:04 Snewmy

Hi @Snewmy, I just finished a new release, try this code now with the new version of pydoll:

async def example_with_context_manager():
    """
    Example using the context manager approach to handle Cloudflare captcha.

    This waits for the captcha to be processed before continuing.
    """
    browser = Chrome()
    await browser.start()
    page = await browser.get_page()

    print('Using context manager approach...')
    async with page.expect_and_bypass_cloudflare_captcha(
        custom_selector=(By.ID, 'TAYH8'), time_before_click=5
    ):
        await page.go_to('https://www.planetminecraft.com/account/sign_in/')
        print('Page loaded, waiting for captcha to be handled...')

    print('Captcha handling completed, now we can continue...')
    await asyncio.sleep(3)
    await browser.stop()

thalissonvs avatar Apr 06 '25 17:04 thalissonvs

print('Using context manager approach...') async with page.expect_and_bypass_cloudflare_captcha( custom_selector=(By.ID, 'TAYH8'), time_before_click=5 ): await page.go_to('https://www.planetminecraft.com/account/sign_in/') print('Page loaded, waiting for captcha to be handled...')

print('Captcha handling completed, now we can continue...')
await asyncio.sleep(3)
await browser.stop()

Hey, unfortunately this isn't working. The code continues on long before the captcha is even done loading when i set the time to click to 25.

Snewmy avatar Apr 06 '25 20:04 Snewmy

it definitely works on the cloudflare test page you put in the readme. I am not sure why its not working on this certain site im trying.

Snewmy avatar Apr 07 '25 20:04 Snewmy

any follow up on this? mine test was also not working. before the new version, it works fine, after certain point, auto solve cloudflare captcha isnt working anymore

sn0wjin19 avatar Apr 26 '25 05:04 sn0wjin19

Hi @sn0wjin19 @Snewmy, do you still have problems with cloudflare bypass?

thalissonvs avatar Jun 08 '25 03:06 thalissonvs