0
votes

So, I need to send text to an input field in an HTML page that doesn't use ID or CLASS. This HTML page doesn't use ID or CLASS anywhere.

I've been able to select the element a few ways:

1)  pwb.document.getElementsByTagName("input")[18].value
2)  pwb.document.GetElementsByName("FindText")[0].Value
3)  pwb.document.FindDlg.FindText.value

The input exists within a form: Html>Body>form>table>tbody>tr>td>font>input

Again, none of the higher elements, or even the element contain an ID or CLASS. I can type something in and get the value to return in a MsgBox, but I can't get AHK to send a value to the text field.

I've tried sending multiple tab commands, as I can get the cursor to appear after hitting tab roughly 7-8 times. But the tab commands don't send as I'm expecting them to.

SendInput, {tab}

from within the javascript console I can use all the above commands and it will change the value to whatever I want it to:

1)  pwb.document.getElementsByTagName("input")[18].value = "something"
2)  pwb.document.GetElementsByName("FindText")[0].Value = "something else"
3)  pwb.document.FindDlg.FindText.value = "something elser"

but AHK seems to be having issue... or rather, I'm having an issue with it.

Help?

1

1 Answers

1
votes

I think you have to focus or click on the element, then send the keystrokes:

pwb.document.getElementsByTagName("input")[18].focus()
Send, something else

or

pwb.document.getElementsByTagName("input")[18].click()
Send, something else

And you may need to experiment with the different "Send" techniques. Hth,