Triggering Events - IE

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
boton
Posts: 8
Joined: 13 Oct 2019, 22:41

Triggering Events - IE

Post by boton » 20 Jun 2021, 13:29

I am trying to automate the login process for this website but having troubles implementing it. My current method is focusing on the element then sending pasting the username then tab to the password input and then pasting the password. This would require the window to be active at all times. I have had success on another website using queryselector and triggering an event change so the website can read the change in value but for this website I'm not to sure what to do.

Queryselector Method that works for another website but doesn't work for the new website I am trying to automate

Code: Select all

target := ie.document.querySelector("INPUT[Name=""username""]")
target.value := "username"
event := ie.document.createEvent("Event")
event.initEvent("change", true, true)
target.dispatchEvent(event)
sleep, 100
target := ie.document.querySelector("INPUT[Name=""password""]")
target.value := "password"
event := ie.document.createEvent("Event")
event.initEvent("change", true, true)
target.dispatchEvent(event)

So far these are what I have tried to change the value and login. I am able to change the value but when I try to click "Sign In" an error will show and say please enter username/password. So the website didn't recognize any change.

Code: Select all

ie.document.getElementByID("usernameInput-input").focus()
sleep, 100
ie.document.getElementByID("usernameInput-input").Value := "username"

ie.document.getElementByID("password-input").focus()
sleep, 100
ie.document.getElementByID("password-input").Value := "password"

Code: Select all

ie.document.getElementByID("usernameInput-input").Value := "username"
ie.document.getElementByID("usernameInput-input").fireevent("onchange")
sleep, 100
ie.document.getElementByID("password-input").Value := "password"
ie.document.getElementByID("password-input").fireevent("onchange")


Return to “Ask for Help (v1)”