Page 1 of 1

pwb click on element help

Posted: 06 Nov 2017, 17:46
by HIAC
Hey, I've ran into a problem

Code: Select all

#SingleInstance, Force

LoginPassword := "admin"

pwb := ComObjCreate("InternetExplorer.Application")  ;// Create an IE object
pwb.Visible := true                                  ;// Make the IE object visible
pwb.Navigate("http://192.168.0.1/login.asp")
while pwb.busy or pwb.ReadyState !=4
	sleep, 100
Password_input := pwb.document.getElementById("Password")
Password_input.value := LoginPassword

pwb.document.getElementById("???????????").click()

There is no Name or ID in element, at least I can't find it, however I have Inner text which is "OK" and Index is "28".. How can I click on that button?
Thanks!

Re: pwb click on element help  Topic is solved

Posted: 06 Nov 2017, 19:37
by boiler
You could use something else it has associated with it like a tag, for which you would use getElementsByTagName. There will be an array of them, then you need to determine which one it is and define that one, such as getElementsByTagName("a")[0] for the first one, [1] for the second one, etc.

Re: pwb click on element help

Posted: 06 Nov 2017, 20:20
by HIAC
That helped me, thank you.
By the way, is there a way to get URL address of element/button?

Re: pwb click on element help

Posted: 06 Nov 2017, 20:22
by boiler
I wasn't aware there is a URL address down to an element, so I wouldn't know how.