Article From:https://segmentfault.com/q/1010000012142669
Question:

A login page, written in react. After the page is generated, enter the user name and click the login page to login.
Here I want to implement a function that fills the username password with the JS script, and then triggers the click event of the submit button.

The username passwords in the page pass through

$("input[name='userName']").val(username);
$("input[type='password']").val(pwd);

All can be assigned normally, as follows:

Then it will appear through the login button click event, as shown in the following picture:

Why is this??

Personal guess does not synchronize data to the react element bound model. Is there a solution?

This is a website made by others. It is the website produced by react that the file is found in it. My side wants to achieve analog user login, through jQuery operation DOM elements, fill data. Trigger the click event and log in by the user.

Answer 0:

You guessed it right, and you didn’t see your code.

Answer 1:

You may need this https://github.com/casperjs/c…

Answer 2:

Do not try to use itjsTo write a crawler, but you can think about it.Python,SimplejsOr more restrictive

Link of this Article: Analog user login problem

Leave a Reply

Your email address will not be published. Required fields are marked *