I am working on a script using Powershell to fill out a website form. I am using my work computer which means I don't have Admin rights. Is it possible to fill out a form on a website using Powershell commands? For example, tab 4 times, keystroke "R", "A", etc., and then tab to the "Submit" button and click it?
Asked
Active
Viewed 228 times
1
-
No. Have your administrator install something more practical for you to use such as [Selenium](https://en.wikipedia.org/wiki/Selenium_(software)) or some respectable [Python libraries](https://automatetheboringstuff.com/chapter18/) – ti7 Nov 26 '17 at 07:16
-
That's what I figured. Thank you for the info. – Maestro Nov 26 '17 at 07:56
-
That's not true, PowerShell can call into .NET libraries and often it's enough to put them in the same folder as your script and load them. https://stackoverflow.com/questions/12923074/how-to-load-assemblies-in-powershell That includes Selenium WebDriver and other useful libraries. – jessehouwing Nov 26 '17 at 08:54
1 Answers
0
You could use the Internet Explorer COM Object:
$ie = new-object -ComObject "InternetExplorer.Application"
$ie.navigate("https://yourURL")
while($ie.busy){sleep -mil 200}
You can then fill out the form with something like this (There are methods for getting by name/id/tagname etc)(this code might not actually work but it should be kinda similar):
$ie.Document.GetElementById("ElementID").value = "yourValue"
....
$ie.document.getElementById("buttonID").click()
The thing to watch out for is the security zone your target website is in. If you find that the Document property of the $ie
object is null after calling .navigate()
then you or your admin need to mark the target site as safe in the IE security settings for it to work without admin privileges.
P.S.: Here is the Documentation for the InternetExplorer.Application
Object: MSDN

Paul
- 5,524
- 1
- 22
- 39