I have this code to login to a ip camera with the username and password.
$cam1 = Invoke-WebRequest -Uri "http://10.2.1.221/doc/page/login.asp?_1506456198818"
$userName = $cam1.ParsedHtml.getElementById('username').value = "cam1"
$password = $cam1.ParsedHtml.getElementById('password').value = "P@4$w0rd*"
$loginButton1 = $cam1.ParsedHtml.body.getElementsByClassName("login-item anonymous")
$loginButton1.click()
But, when I call $loginButton1.click(), it gives the message below. According the the Get-Member, $loginButton1 have a method called click.
Method invocation failed because [System.__ComObject] does not contain a method named
'click'.
+ $loginButton1.click()
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (click:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
PS C:\WINDOWS\system32> $loginButton1 | Get-Member
TypeName: System.__ComObject#{3050f50c-98b5-11cf-bb82-00aa00bdce0b}
Name MemberType Definition
---- ---------- ----------
addBehavior Method int addBehavior (string, Variant)
addFilter Method void addFilter (IUnknown)
appendChild Method IHTMLDOMNode appendChild (IHTMLDOMNode)
applyElement Method IHTMLElement applyElement (IHTMLElement, string)
attachEvent Method bool attachEvent (string, IDispatch)
blur Method void blur ()
clearAttributes Method void clearAttributes ()
click Method void click ()