3 ms·
Browser automation will occur by executing events in the DOM or by calling properties of the page/window. It’s all JavaScript designed for user interaction exec
by austincheney 5y ago
Browser automation will occur by executing events in the DOM or by calling properties of the page/window. It’s all JavaScript designed for user interaction executed by a bot.
The one event that cannot be automated is cursor movement/position. Put a check into your event handlers that check that the cursor is actually over the event target.
- headlessvictim2 5y agoThis is interesting. Thanks for sharing. Are you saying block form submission unless the cursor is over the event target? If so: * How to handle legitimate requests from mobile users? * How to handle form submissions with the "return" key?
- austincheney 5y agoMobile users will use touch events instead of click events and likely your interface will be different and the screen width will be different. Check for these things along with keywords from the user agent string to determine mobile users from other users. Return key on a control in a form will fire a submit event. Check for cursor position in your submit handler.
- darkstar999 5y agoThat sounds like an accessibility problem.
- austincheney 5y agoUse an alternate control for keyboard navigation that is visually hidden and is accessed only by tab focus.
- mesadb 5y agoYou are right every testing solutions out there push UIEvents to the page rather than clicking with an actual mouse. That's why puppeteer, selenium etc are scraping tools not testing tools