Im trying to logon to a web page, go to a page, modify a value, and save it.
There are two ways to do this: “$ie = New-Object -com internetexplorer.application;” OR “Invoke-WebRequest”. I perfer to do the way that is more clear to me.
Trying to do it thru “$ie = New-Object -com internetexplorer.application”, I get a error when trying $ie.Document.getElementsByName as in:
Cannot find an overload for “getElementsByTagName” and the argument count: “1”.
This only happens in Windows Server 2012 R2, not in Windows 7.
I havent played around too much with Invoke-WebRequest as Im not too sure how to do it.
I had this for now:
$initialRequest = Invoke-WebRequest -Uri ‘http://192.168.100.97/csl/login’ -SessionVariable WebSession1
form = $initialRequest.Forms[0]
$form.fields.userpwd = “mypass”
$form.fields.username = “myuser”
$loginRequest = Invoke-WebRequest -Uri (‘http://192.168.100.97/csl/login’ + $form.Action) -Method Post -Body $form.fields -WebSession $WebSession1
$tcpipRequest = Invoke-WebRequest -Uri ‘http://192.168.100.97/form/Device?act=5’ -WebSession $WebSession1
TODO: After this, I want to first test going to I need to go http://192.168.100.97/form/Device?act=5
TODO: Then I need to get the text value inside a textbox called gateway
So how do I keep going?