I have been using the following in a script with success:
$ie.document.getElementById("userid").value= "$user"
and
$comShell = New-Object -com "Wscript.Shell"
$comShell.sendkeys($USERC)
I used the top one when the site has <input id="userid"> and if the id changes from site to site I just make minor alterations to the script. I have been using the second when the input is not defined with an id, but a name, as there seems to be no method of getElementByName. This only works with sites that by default have the focus set on the userid field.
I now encountered a site that defines the input with a name, not id, AND the user id field is not the default focus.
What could I use for something like this:
<INPUT SIZE="9" STYLE="font-family:Arial; font-size: 10pt; " type="text" name="USERID" maxlength="8" value="" onKeypress="passwordFocus(event)">
For my job I have been creating a utility to facilitate a number of tasks, one of which is a links area that provides shortcut (bookmarks) to some sites we frequently use and enters the generic id, so one does not have to try to find it at the last moment.
Any help would be greatly appreciated.