Greasemonkey - how to click button after user input?

Scorpion Ghost

Elite Member
Executive VIP
Jr. VIP
Joined
Mar 22, 2013
Messages
9,143
Reaction score
10,489
Ok I really need a bit of help here. I started using a captcha service to solve some captchas, using a Firefox extension to do it. The extension has a function called "Auto submit FORM after solving," but unfortunately instead of submitting the form, it actually just refreshes the captcha :(

So I want to make a Greasemonkey script to submit the form. Now I can add a delay time, say 30 seconds after page load to click the button. But then what if the captcha takes 31 seconds to be solved? Not very efficient.

So I'm thinking, how can I do this:

1) Page loads
2) Greasemonkey waits for field X to be filled with text
3) After it's filled with text, Greasemonkey waits 2 more seconds
4) Greasemonkey clicks button

Come on guys, help me out please, I'm dying here :D

Thanks
 
Thanks a lot for the help yalls :p

I think I figured it out...

I did some googling, searched for titties, and landed here - https://stackoverflow.com/questions...m-but-the-user-and-password-are-not-filled-in

Then I smashed the lap top about 10 times on the wall, and the code got all edited on its own, and poof suddenly it works:

Code:
var numIntervals    = 0;  
var pwFilledTimer   = setInterval ( function () {
        var usrNameInp  = document.getElementById ("someid");
        if (usrNameInp  &&  usrNameInp.value != "") {

{

                clearInterval (pwFilledTimer);

                var submitButton = document.querySelector (
                    'input[type="sometype"][value="somevalue"]'
                );
                var clickEvent  = document.createEvent ('MouseEvents');
                clickEvent.initEvent ('click', true, true);
                submitButton.dispatchEvent (clickEvent);
            }
        }
        numIntervals++;
        if (numIntervals > 1000) {
            /*--- Stop the timer after about 2 seconds so it doesn't
                interfere with manual logins.
            */
            clearInterval (pwFilledTimer);
        }
    },
    200
);

I've waited up to 60+ seconds after page loads, and the moment I insert anything in the input box, the button gets automatically clicked.

This leaves me with 2 questions:

1) Will it actually work when the captcha extensions fills in the box (not me manually with keyboard)
2) If it does work, will the captcha extension be fast enough to input the entire captcha before greasemonkey clicks the button

I'll let you know in a bit...
 
Okay, well, that did it. Who's your daddy bitch! ;)

But let's not get too cocky, I only tested it under light load. I wonder what's gonna happen under heavy load when both CPU and RAM are reaching Max.

Oh well, we'll know soon enough, day or two.

I may be back on this thread trying to add a delay to the clicking of the button after the input field is filled with the captcha solution, or something. We'll see how it goes...

Thanks all for the help I really appreciate it :D
 
Back
Top