Im building a bot and im wondering whether if its even possible for sites to detect javascript executions on the console. For example for a certain site the bot needs to add the item to cart and I do this
document.getElementsByClassName('w_C8 w_DA w_DF')[0].click()
through the bot will sites be able to detect that it wasn't an actual human clicking or will they automatically now it was code run to click the button
CodePudding user response:
Yes they will be able to detect that, because click event contains more than just an information that it have been clicked, for example coordinates of a mouse pointer. You can check that yourself by defining onclick function, for example:
document.body.onclick = function(e){console.log(e));
document.body.click();
Now click and check the difference in console.
In onclick event object there is also a direct notification if it was actually clicked, or triggered:
e.isTrusted: false // clicked automatically
e.isTrusted: true // real click
Does anybody actually check that? Most sites surely don't.