I have been instructed to crawl a website created with React. I am trying to fill in the input fields and submit the form using javascript injection on the page (selenium or web browsing on mobile devices). It works like a charm on all other sites + technology, but React seems like a real pain.
so here is a sample code
var email = document.getElementById( 'email' ); email.value = ' example@mail.com ';
The I value changes on the DOM input element, but React does not raise a change event.
I tried to use many ways for React to update the state.
var event = new Event('change', { bubbles: true }); email.dispatchEvent( event );
To no avail
var event = new Event('input', { bubbles: true }); email.dispatchEvent( event );
does not work
email.onChange( event );
does not work
I can't believe the interaction with React was so complicated. I would really appreciate any help.
thanks
source share