Try the following:
$ie.document.getElementByID("ns_7_CO19VHUC6FFPF0I5O4OBCT2OE4_flightNumber").value = $flightNumber
This works for me. I found the identifier by looking at the source code through my browser.
I do not know why getElementsByName does not work. Perhaps someone else can shed light on this?
Edit:
Ok, I figured it out. getElementsByName returns the collection. You must iterate through the collection to set the value. So your code will look like this:
#Flight Number (Only Lufthansa) #For example flight number [string]$flightNumber = "LH 3102" $ie = new-object -com "InternetExplorer.Application" $ie.navigate("http://www.lufthansa.com/de/de/Ankunft-und-Abflug") $ie.visible = $true sleep 5 #while ($ie.busy) {sleep -milliseconds 50} while($ie.ReadyState -ne 4) {start-sleep -m 100} $elements = $ie.document.getElementsByName("flightNumber") Foreach($element in $elements) { $element.value = $flightnumber }
It worked for me.
source share