Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using without an "submit" button #3

Closed
gitvitox opened this issue Apr 6, 2021 · 32 comments
Closed

Using without an "submit" button #3

gitvitox opened this issue Apr 6, 2021 · 32 comments

Comments

@gitvitox
Copy link

gitvitox commented Apr 6, 2021

Hey,

on some HCaptcha protected sites there aren't any "submit" buttons like in your example.

If you try to register an account on Discord for example.

Are there any ways to solve this? I know on Recaptcha there was an callback function. But I don't know too much about HCaptcha.

Thanks:)

@awxlfy
Copy link
Collaborator

awxlfy commented Apr 6, 2021

I haven't ever tried to use the discord website for this but you can try something like this:

  1. Fill out for form using Puppeteer like normal.
  2. Call the solve hcaptcha method.
  3. Once the method has solved the hcaptcha you can try something like await page.keyboard.press('Enter') or await page.type(String.fromCharCode(13)) to submit the page.

Not entirely sure if this works but let me know.

Edit:

Another thing you can also do is submit the form using plain javascript. I believe something like this would also be an option:

await page.evaluate(() => {
    document.querySelector('formselector').submit();
});

@awxlfy
Copy link
Collaborator

awxlfy commented Apr 9, 2021

Haven't heard anything in a few day so I am going to close this issue

@awxlfy awxlfy closed this as completed Apr 9, 2021
@popeyebot
Copy link

I haven't ever tried to use the discord website for this but you can try something like this:

  1. Fill out for form using Puppeteer like normal.
  2. Call the solve hcaptcha method.
  3. Once the method has solved the hcaptcha you can try something like await page.keyboard.press('Enter') or await page.type(String.fromCharCode(13)) to submit the page.

Not entirely sure if this works but let me know.

Edit:

Another thing you can also do is submit the form using plain javascript. I believe something like this would also be an option:

await page.evaluate(() => {
    document.querySelector('formselector').submit();
});

Hello, I have the same problem and I tried what you said.
The callback isn't submited at all. Do you have another suggestion to solve this issue ?

@BrokedTV
Copy link

I haven't ever tried to use the discord website for this but you can try something like this:

  1. Fill out for form using Puppeteer like normal.
  2. Call the solve hcaptcha method.
  3. Once the method has solved the hcaptcha you can try something like await page.keyboard.press('Enter') or await page.type(String.fromCharCode(13)) to submit the page.

Not entirely sure if this works but let me know.
Edit:
Another thing you can also do is submit the form using plain javascript. I believe something like this would also be an option:

await page.evaluate(() => {
    document.querySelector('formselector').submit();
});

Hello, I have the same problem and I tried what you said. The callback isn't submited at all. Do you have another suggestion to solve this issue ?

Did you find a working solution?

@FuckingToasters
Copy link

  • Manually register a discordaccount.
  • Open devconsole by pressing F12 & visit the Network tab. t
  • Maunually solve the captcha and find the requests it do in Network Tab.
  • You'll find a request to the hcaptcha site with the captchatoken.
  • You can get the captchatoken by using the captchatools libary.
  • Do the same post request to the api using the captchatoken within discord.

I'm not at home yet so i can't provide the correct code for it but i will do, if i'm at home.

@Evolgate
Copy link

Evolgate commented Jun 2, 2022

@FuckingToasters It would be nice to see some code, better even for python as on discord there is a hcaptcha without submit button when logging in. I get my token from 2captcha but no idea how to submit it

Help highly appreciated

@FuckingToasters
Copy link

FuckingToasters commented Jun 2, 2022

@FuckingToasters It would be nice to see some code, better even for python as on discord there is a hcaptcha without submit button when logging in. I get my token from 2captcha but no idea how to submit it

Help highly appreciated

Hi, there are different ways to automatically solve hcaptcha were no submit button is located on page.
Here are a few solutions you can try:

  1. You don't need any captchasolver for hcaptcha as they have a accessibility cookie, which when inserted into the webpage solve captchas instantly. Note that this is not created by me, just wanted to share it to help you guys out.
    https://github.com/avengy/hcaptcha-bypass-discord
    or
    https://gist.github.com/ExordiumX/3a27f2004137e1d1b461f36329b92185

  2. run the discord callback function by executing javascriptcode within the browser:

  • Open the console and execute the following cmd: __grecaptcha_cfg.clients
  • Find the path which has the callback function, in my case it's ___grecaptcha_cfg.clients[0].O.O
  • Use the following code: driver.execute_script(f"___grecaptcha_cfg.clients[0].O.O.callback('{new_token}')")
    (Remember to change the path accordingly)

Source to number 2

Note, that i didn't tried any solution mentioned above. Next two weeks i have time to look into this case and can improve the mentioned codes to fit the discord site.

@aw1875
Copy link
Owner

aw1875 commented Jun 2, 2022

It seems like a lot of people struggle with trying to submit a page without a submission button so I may push a new update that will do it for you (prefer not to thought). A really simple solution is exactly what @FuckingToasters explained and can be accomplished with realistically one line of code in javascript.

An example code block using puppeteer would be:

await page.evaluate((token) => {
    `__grecaptcha_cfg.clients[0].0.0.callback('${token}')`;
}, token);
Screen.Recording.2022-06-02.at.9.58.09.AM.mov

@Evolgate
Copy link

Evolgate commented Jun 3, 2022

Thanks for the reply, when I put __grecaptcha_cfg.clients into the console it says:

Uncaught ReferenceError: __grecaptcha_cfg is not defined
    at <anonymous>:1:1

@FuckingToasters
Copy link

Thanks for the reply, when I put __grecaptcha_cfg.clients into the console it says:

Uncaught ReferenceError: __grecaptcha_cfg is not defined
    at <anonymous>:1:1

you need to run when the captcha is located on page i guess

@Evolgate
Copy link

Evolgate commented Jun 3, 2022

I do, but sadly it always does error, would you mind trying it yourself?
https://discord.com/login

@FuckingToasters
Copy link

FuckingToasters commented Jun 3, 2022

I do, but sadly it always does error, would you mind trying it yourself? https://discord.com/login

I'm currently working on a registrator. i'm not on captcha page so far

Update, i'm now on the captchapage and the the solutions i sent above did somehow not work for me. I'm now looking for help too :)

@Evolgate
Copy link

Evolgate commented Jun 4, 2022

I do, but sadly it always does error, would you mind trying it yourself? https://discord.com/login

I'm currently working on a registrator. i'm not on captcha page so far

Update, i'm now on the captchapage and the the solutions i sent above did somehow not work for me. I'm now looking for help too :)

So this document.getElementById('anycaptchaSolveButton').onclick('TOKEN'); seems to do something when following this Bypass HCaptcha with Callback tutorial. But it errors in
Uncaught N {cause: 'invalid-captcha-id', message: 'Invalid hCaptcha id: 0kiqjsyvldr'}
Maybe someone managed to make it work?

@Evolgate
Copy link

Evolgate commented Jun 4, 2022

Also there is this youtube tutorial, anyone understands it and could share if it works and how if yes?

@FuckingToasters
Copy link

Yo i got great news fr you guys. It is not difficult to solve it.

driver.execute_script("document.querySelector('iframe').parentElement.parentElement.__reactProps$.children.props.onVerify('{}')".format(captcha_answer))

Good Luck with it :)

@aw1875
Copy link
Owner

aw1875 commented Jun 5, 2022

Yo i got great news fr you guys. It is not difficult to solve it.

driver.execute_script("document.querySelector('iframe').parentElement.parentElement.__reactProps$.children.props.onVerify('{}')".format(captcha_answer))

Good Luck with it :)

Interesting, I may look into a javascript alternative for this for anyone attempting to submit the page this way in a javascript project. Glad to hear you were able to get it working thought.

@FuckingToasters
Copy link

Yo i got great news fr you guys. It is not difficult to solve it.

driver.execute_script("document.querySelector('iframe').parentElement.parentElement.__reactProps$.children.props.onVerify('{}')".format(captcha_answer))

Good Luck with it :)

Interesting, I may look into a javascript alternative for this for anyone attempting to submit the page this way in a javascript project. Glad to hear you were able to get it working thought.

I'm not really familiar with JS but i'm 100% sure that in js there is also a function which execute javascriptcode in the browser. this should work there too.

@aw1875
Copy link
Owner

aw1875 commented Jun 5, 2022

Ya in puppeteer the await page.evaluate(() => { code here }); function can be used for evaluating javascript code in the browser. The only part of your code I think would be difficult is obtaining the function via the __reactProps command because realistically the element changes each time you load the page. For example, this is one example of the element document.querySelector('iframe').parentElement.parentElement['__reactProps$dlqtwzl9fm'];. You can see that it contains the id of dlqtwzl9fm which will change if I refresh the page. Otherwise the rest of the code is pretty easy to understand and can easily be converted.

@FuckingToasters
Copy link

Ya in puppeteer the await page.evaluate(() => { code here }); function can be used for evaluating javascript code in the browser. The only part of your code I think would be difficult is obtaining the function via the __reactProps command because realistically the element changes each time you load the page. For example, this is one example of the element document.querySelector('iframe').parentElement.parentElement['__reactProps$dlqtwzl9fm'];. You can see that it contains the id of dlqtwzl9fm which will change if I refresh the page. Otherwise the rest of the code is pretty easy to understand and can easily be converted.

Oh okay. Well the code that i sent which is able to solve captchas works fine even if the ID changes i guess.

@dave-uni
Copy link

dave-uni commented Jun 13, 2022

I am having a similar issue when submitting an hcaptcha token in discord. But not when registering an account rather when joining an hcaptcha protected server like this one: https://discord.gg/undw3
I used ur suggested onVerify() function to submit the captcha request. However I always get an captcha required response error:

data:{captcha_key: [ 'captcha-required' ],
captcha_sitekey: 'a9b5fb07-92ff-493f-86fe-352a2803b3df',captcha_service: 'hcaptcha',captcha_rqdata:'EKrvUksnQGqq25nJxCIsI222EXTg0mThFz+j7SJ2+NdkWuL85+ewEaYVkRLdH/TCx3mN9ZG/Hxut6C/iA2ZXkBLP4/NdNEL7O2/M9kpqyhKyrL/na1YpHMC7jqouawssQlmRZd8Y/G14B+R288G+hcK6udR3YbnTyaR2vxPe',captcha_rqtoken:IkV2QmFhTFNSQ203T1l2R3FQY0YwUktRMElsTS8rZkxjcEhpNko0V2E4R3B4Q2FtWWFqd2t6ZGFLVFRIUFdra2ZaSUdkM3c9PXhJNE9mRGFESE9MRmUwWHIi.YlHM_A.Ho9gBr5GV7x7hlC243auvNRIxMc'}

Even though the captcha key is within the payload of the request. There is something missing and I just can not finde out what, I would highly appreciate if u could help me with this one.

Ya in puppeteer the await page.evaluate(() => { code here }); function can be used for evaluating javascript code in the browser. The only part of your code I think would be difficult is obtaining the function via the __reactProps command because realistically the element changes each time you load the page. For example, this is one example of the element document.querySelector('iframe').parentElement.parentElement['__reactProps$dlqtwzl9fm'];. You can see that it contains the id of dlqtwzl9fm which will change if I refresh the page. Otherwise the rest of the code is pretty easy to understand and can easily be converted.

Oh okay. Well the code that i sent which is able to solve captchas works fine even if the ID changes i guess.

@FuckingToasters
Copy link

FuckingToasters commented Jun 14, 2022

I am having a similar issue when submitting an hcaptcha token in discord. But not when registering an account rather when joining an hcaptcha protected server like this one: https://discord.gg/undw3 I used ur suggested onVerify() function to submit the captcha request. However I always get an captcha required response error:

data:{captcha_key: [ 'captcha-required' ],
captcha_sitekey: 'a9b5fb07-92ff-493f-86fe-352a2803b3df',captcha_service: 'hcaptcha',captcha_rqdata:'EKrvUksnQGqq25nJxCIsI222EXTg0mThFz+j7SJ2+NdkWuL85+ewEaYVkRLdH/TCx3mN9ZG/Hxut6C/iA2ZXkBLP4/NdNEL7O2/M9kpqyhKyrL/na1YpHMC7jqouawssQlmRZd8Y/G14B+R288G+hcK6udR3YbnTyaR2vxPe',captcha_rqtoken:IkV2QmFhTFNSQ203T1l2R3FQY0YwUktRMElsTS8rZkxjcEhpNko0V2E4R3B4Q2FtWWFqd2t6ZGFLVFRIUFdra2ZaSUdkM3c9PXhJNE9mRGFESE9MRmUwWHIi.YlHM_A.Ho9gBr5GV7x7hlC243auvNRIxMc'}

Even though the captcha key is within the payload of the request. There is something missing and I just can not finde out what, I would highly appreciate if u could help me with this one.

Ya in puppeteer the await page.evaluate(() => { code here }); function can be used for evaluating javascript code in the browser. The only part of your code I think would be difficult is obtaining the function via the __reactProps command because realistically the element changes each time you load the page. For example, this is one example of the element document.querySelector('iframe').parentElement.parentElement['__reactProps$dlqtwzl9fm'];. You can see that it contains the id of dlqtwzl9fm which will change if I refresh the page. Otherwise the rest of the code is pretty easy to understand and can easily be converted.

Oh okay. Well the code that i sent which is able to solve captchas works fine even if the ID changes i guess.

I'm not sure and not tried following info but it might help you a bit.
Before i sent the code which solve hcaptcha on discord registration website, there was a discussion using the callback function. This might help you on the page when joining the Server. Quote to which message im refering to below:

@FuckingToasters It would be nice to see some code, better even for python as on discord there is a hcaptcha without submit button when logging in. I get my token from 2captcha but no idea how to submit it
Help highly appreciated

Hi, there are different ways to automatically solve hcaptcha were no submit button is located on page. Here are a few solutions you can try:

1. You don't need any captchasolver for hcaptcha as they have a accessibility cookie, which when inserted into the webpage solve captchas instantly. Note that this is not created by me, just wanted to share it to help you guys out.
   https://github.com/avengy/hcaptcha-bypass-discord
   or
   https://gist.github.com/ExordiumX/3a27f2004137e1d1b461f36329b92185

2. run the discord callback function by executing javascriptcode within the browser:


* Open the console and execute the following cmd: `__grecaptcha_cfg.clients`

* Find the path which has the callback function, in my case it's ` ___grecaptcha_cfg.clients[0].O.O`

* Use the following code: `driver.execute_script(f"___grecaptcha_cfg.clients[0].O.O.callback('{new_token}')")`
  (Remember to change the path accordingly)

Source to number 2

Note, that i didn't tried any solution mentioned above. Next two weeks i have time to look into this case and can improve the mentioned codes to fit the discord site.

@Graptos
Copy link

Graptos commented Mar 23, 2023

Yo i got great news fr you guys. It is not difficult to solve it.

driver.execute_script("document.querySelector('iframe').parentElement.parentElement.__reactProps$.children.props.onVerify('{}')".format(captcha_answer))

Good Luck with it :)

I get the following error:
selenium.common.exceptions.JavascriptException: Message: javascript error: Cannot read properties of undefined (reading 'children')

Please tell me what can be done with this?

@Romhast
Copy link

Romhast commented May 4, 2023

same error, can you help me ?

@aw1875
Copy link
Owner

aw1875 commented May 4, 2023

selenium.common.exceptions.JavascriptException: Message: javascript error: Cannot read properties of undefined (reading 'children')

@Romhast if you're asking about this error, it is a selenium error and has nothing to do with Puppeteer or this plugin. I'd suggest checking out selenium's issues or maybe StackOverflow.

@Romhast
Copy link

Romhast commented May 4, 2023

image
This was tried on the developer console on my own browser ( edge ) without using selenium and the same error continues.

@FuckingToasters
Copy link

I modified the code i sent above a bit:

document.querySelector('iframe').parentElement.parentElement.__reactProps$yczaqvmjd7p.children.props.onVerify('captchasolution')

See, __reactProps$ changed to __reactProps$yczaqvmjd7p. I got these characters after the dollar sign suggested in a dropdown menu when i manually typed out the whole code. After refreshing the page, it seem that the ID change so you get an undefined error thus there need to be a way to run other Javascriptcode before that code which return the current correct ID but i don't know how one would do this.

@FuckingToasters
Copy link

@Frosco03
Copy link

Hi! I stumbled upon this while trying to find a way to solve hcaptcha from another website. I still haven't found a fix but maybe it would be of help for solving your problem in discord.

there need to be a way to run other Javascriptcode before that code which return the current correct ID but i don't know how one would do this.

document.querySelector('iframe').parentElement.parentElement
returns an array of the properties. The __reactProps$ is usually the second element in the array, so maybe by storing the above command in a temporary variable, we can access the second member and continue with the rest of the command.

For instance:
var frameParent = document.querySelector('iframe').parentElement.parentElement; frameParent[1].children.props.onVerify('captchasolution');

Hope it helps.

@cattodotpy
Copy link

You have to get all the values inside of the element in order to get the "reactProps"

I've modified the code above to
Object.values(document.querySelector('iframe').parentElement.parentElement)[1].children.props.onVerify("solution")

@Maxhem2
Copy link

Maxhem2 commented Sep 6, 2023

Here kiddos
document.querySelector('iframe').parentElement.parentElement[Object.keys(document.querySelector('iframe').parentElement.parentElement).filter(k=>k.includes('reactProps')).toString()].children.props.onVerify('2CAPTCHATOKEN')

@atrix69
Copy link

atrix69 commented Sep 10, 2023

Here kiddos document.querySelector('iframe').parentElement.parentElement[Object.keys(document.querySelector('iframe').parentElement.parentElement).filter(k=>k.includes('reactProps')).toString()].children.props.onVerify('2CAPTCHATOKEN')

Hello dear Maxhem2. If i need solve hCapthca, but not in Discord, what need i change in this code? I spend 4 h and didnt find the way to callback hCaptcha without button... https://nopecha.com/demo/hcaptcha simpple site, but i`m idk. I want to learn this way, can u help me?

@longnguyenQB
Copy link

Object.keys(document.querySelector('iframe').parentElement.parentElement).filter(k=>k.includes('reactProps')).toString()

Hello! I have this problem when running on the console, hoping this topic is still working, looking forward to everyone for help

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests