I’m trying to insert text into the textbox of a website but I seem to be doing something incorrect because I keep getting an error in the Powershell ISE. The code I’m using is:
($ie.Document.DocumentElement.getElementsByClassName('web-password-input') | Select-Object -First 1).value = 'asdf'
The error it shows in the ISE is:
The property 'Value' cannot be found on this object. Verify that the property exists and can be set. At C:\Users\file.ps1:53 char:5 + ($ie.Document.DocumentElement.getElementsByClassName('web-passwor ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : PropertyNotFound
I used this code earlier in the project and it worked correctly, granted this is to submit a button and not insert text.
$fs = $ie.Document.DocumentElement.getElementsByClassName('right-nav button button-link last') | Select-Object -first 1 $fs.click()
The HTML code that I’m trying to target is:
Any help would be greatly appreciated.