Reputation: 25
I am trying to write a script to automate a task I'd need to do. So I need this script to check if python is on the /login
page and if he is, to enter the username and password for logging in.
For username when logging in, in HTML, it is an input type="text" name="username"
and for the password it is an input type="password" name="password"
. I did search and saw that I should use requests but I only saw them executing POST methods and I'm not sure if this is the case here as well.
Upvotes: 0
Views: 1422
Reputation: 116
Yes selenium works well for this, just to give you some hints. I've done this type of program in the past:
selenium allows you to click on buttons on a website (you can use this to navigate to the login page).
Then it allows you to enter data into text fields (this is using a .send_keys() function which you will use to input your name/password).
Lastly, to actually login you can use the click() function to click on the login button or use send_keys() to "click" enter on the keyboard.
Once you get it working its actually really fun to watch.
Upvotes: 1