node.jsweb-scrapingpuppeteercaptchaapify

How to get challenge key from a target website using geetest captcha


So I am scraping data from a target website using puppeteer. Target website used geetest captcha, for anti-captcha, I am using 2capcta service, on their documentation, it's mentioned that we need to get the challenge key every time.

From that the problem begins, target website has embedded the challenge key under

<Iframe>
<Html>
<head>
<script>

when accessing the iframe through DOM elements throw me a CORS error.

I have tried another way also which is available on the scraper box link is below

https://scraperbox.com/blog/solving-a-geetest-slider-captcha-with-puppeteer

it throws me no selector '[aria-label="Click to verify"]' found

it tried the codegrepper way link is below

https://www.codegrepper.com/code-examples/whatever/puppeteer+get+network+requests

throw me on console.error().

Any help would be appreciated to bypass geetest captcha let me know also if my question is unclear.


Solution

  • Thank you so much for the answer, so with the response by the above gentleman, the final solution is

    when you load your page through puppeteer

       await page.waitForSelector('iframe');
    

    this will wait till the time iframe is loaded, now for me the target website has use the iframe with hash link to access it

    const elementHandle = await page.$('iframe');
    const frame = await elementHandle.contentFrame();
    

    now the frame will have access to your iframe page, so you use the rest same like

     await frame.waitForSelector("your selector")