How can I login with CasperJS by submitting a form. I searched google and haven't found any good examples about it.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
You will need to use Casper fill() function.
Below is an example which login to Facebook and print out your name after login. Note that you need to put in your username and password:
Here is a slightly changed version of the code from Ngo Hung. The selector for the username was off as was the assignment of the userAgent:
UPDATE: I recommend anyone else to use a site of their own, or at least not facebook.com if they are planning large amounts of testing. Facebook could tell that I was trying to log in over and over started emailing me and making me confirm my account with SMS.