A simple click() method script sometimes work and sometimes don't

I ask the following question as a Javascript freshmen. I usually learn the language in a linear track, and I came across a problem beyond my current knowledge, that seems to deal with Information Security as well:

I have the following code I execute in Chrome with Tampermonkey, which I use to login to digitalocean.com.

setTimeout (function() {
}, 3000);

The code sometimes work and sometimes it doesn’t: Sometimes I’m logged in and sometimes (most cases) I get DigitalOcean’s 404 webpage.

My login details are already saved in local storage and appear on the form.

To reproduce, register to DigitalOcean, install Tampermonkey, executing the code with it, with the match:


Might something be missing to ensure human-like behavior in the eyes of the machine?

How are you filling out the username and password?

The script is doing what you tell it. The problem is most likely with however you are entering the credentials.

I edited the question - My details are already stored in local storage and appear in the form.

How do they do that?

As mentioned, there is nothing wrong with the snippet you posted, so this kinda makes it hard to reproduce the issue.

What do you mean by how they do that? I know it is taken from local storage but I don’t know how exactly.

Did you log in once, then have your browser remember the login details? There’s still a piece of the puzzle missing.

Yes. That’s what I did.

Good news:

It seems like a bug in Tampermonkey because the original code works fine from the devtool console.

Yep I verified, it’s a bug in Tampermonkey. Greasemonkey doesn’t have this beahvior.

Is there any reason you wouldn’t just ask Digital Ocean to remember you? That way you remain logged in.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.