1

Is there any possibility to fill specific login form as Pinterest's one in JavaScript?

Here's the link - https://www.pinterest.com/login/

Some hints:

Login field's id is "email"

Password field's id is "password"

There's no chance to fill it by:

document.getElementById("email").value = "username";
document.getElementById("password").value = "password";

because entered data will dissapear after clicking "Login" or clicking into textfields.

Community
  • 1
  • 1
  • 1
    Are you trying to get the browser to fill in the username and password with saved data from the browser itself, or do you have the username and password that you want to autofill in a variable? Some more context is needed for this question. – KingCoder11 Mar 30 '18 at 19:05
  • Possible duplicate: https://stackoverflow.com/questions/8715000/enabling-browsers-form-auto-filling – KingCoder11 Mar 30 '18 at 19:06
  • I want to fill in the credentials fields + perform login directly via JavaScript – SmallDevice Mar 30 '18 at 19:06
  • @SmallDevice if pintrest offer an endpoint API yes you can do it with javascript – Abslen Char Mar 30 '18 at 19:13
  • Yes, I have the credentials, I just want to perform whole process via JS, simulating a real user logging. About duplicate - definitely not – SmallDevice Mar 30 '18 at 19:13
  • You are probably bypassing their own JS validating. Try sending keypresses to the input fields instead of just setting the values. – Nick Mar 30 '18 at 19:18

1 Answers1

0

In this answer I am assuming that you have the variables with the information needed. If you want the browser to autofill for you, you can do that here: Enabling browser's form auto-filling.

Here is a snippet:

// You can change this to whatever you want to autofill
var username = "Anything You Want";

// window.onload makes sure that we are not trying to get the
// element before it is ready
window.onload = function() {
  // .value is because this is a input tag
  document.getElementById("username").value = username;
};
<input id="username">
KingCoder11
  • 415
  • 4
  • 19