0

I have input field like below

<input type="password" placeholder="Password" autocorrect="off" maxlength="30" autofocus="autofocus" animate="true" label="" rules="[object Object]">

and button like below

<button type="submit" class="button-orange wide">Login <!----></button>

So i am filling password with pure javascript like below

document.querySelectorAll('input[type=password]')[0].value = "12345";
document.querySelectorAll('.button-orange')[0].click();

Problem is the actual website is tracking keydown or something , its always alerting me password is empty also when i focus on input password tab , Password filled getting empty.

How do i fill password like real human typed it.

Gracie williams
  • 1,287
  • 2
  • 16
  • 39
  • [How do I programmatically force an onchange event on an input?](https://stackoverflow.com/questions/136617/how-do-i-programmatically-force-an-onchange-event-on-an-input/136810) - this might help – Kos Feb 23 '19 at 14:49
  • try to trigger keyevents https://stackoverflow.com/questions/961532/firing-a-keyboard-event-in-javascript – Madhawa Priyashantha Feb 23 '19 at 14:49
  • I tried both , its still making my inputfield empty on focus – Gracie williams Feb 23 '19 at 14:53

1 Answers1

0

May be you have to set redOnly property of the field to true after filling it with value by JavaScript

document.querySelectorAll('input[type=password]')[0].value = "12345";
document.querySelectorAll('input[type=password]')[0].readOnly = true;
Osama
  • 2,912
  • 1
  • 12
  • 15