0

I want to replicate human actions over a page repetitively. My current app uses a JavaScript Chrome Extension. It clicks by detecting the element my cursor is on and using the .click() function. It inputs text over <textarea> and <input> with .value. However, this can easily be detected by javascript. Some websites don't even glimpse at the .value for inputs. Instead, they detect input information with user actions, rendering this useless. I have tried using element.dispatchEvent to replicate human typing features:


function text(element, char){
  // char parameter would be in this format: {key: " ", keycode: 32, ...}
  const event = new Event("keydown",{bubbles: true, key: char.key, keycode: char.keycode, code: char.code, location: char.location});
  element.dispatchEvent(event);
  element.value += char.key; }

The Event Dispatchment Method does not work at all, and it appeared to have no result besides adding the character parameter to the element's value.


Note that

  • Javascript isn't required
  • An already-created app would work as long as it can repeat click and input motions
  • Continuing the dispatchEvent idea is not required
Jake
  • 97
  • 1
  • 9

0 Answers0