0

i want to autofill input field on page load, yes i am injecting javascript in website, i have tried xpath method

function inputfillclick() {
  var xpath = "//input[@type='password']";
  var inputElement = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  if (inputElement) {
    inputElement.value = "KuchBhi";
  } else {
    console.log("Input element not found.");
  }
}

it is working but not fully i mean, after filling input i can't click login button, but if i paste or remove one letter and again type then login button enabled, is there any otherway to do that, i have used another extension that is working which is also fill input using xpath, but for some reasons i can't use that extension,

here is element code

<input maxlength="140" step="" enterkeyhint="done" autocomplete="off" type="password" class="uni-input-input">

you can clearly see in the picture that this method is not filling input fully i mean, placeholder text is still showing,password problem

Habib
  • 5
  • 4
  • Maybe firing a "change" event on `inputElement` after having changed its value? Please refer to [this answer](https://stackoverflow.com/a/23612498/4698373). – Philippe May 23 '23 at 18:47
  • any example, how can i do that, if you can provide console script, or complete javascript – Habib May 24 '23 at 18:45

0 Answers0