I am using powershell to automate login page but when i navigate to login console page there is no $ie.document method is visible. and showing the null error. Method present for console page are :
CreateObjRef
Equals
GetHashCode
GetLifetimeService
GetType
InitializeLifetimeService
ToString
Code I am using is :-
$ie = New-Object -ComObject 'internetExplorer.Application'
$ie.Visible= $true # Make it visible
While ($ie.Busy -eq $true) {Start-Sleep -Seconds 7;}
$ie.Navigate("https://matlktwlsapp001:16311/ibm/console/")
start-sleep -s 2;
$ie | gm;
$qw = $ie.document.getElementById("overridelink");
$qw.click();
Error:- You cannot call a method on a null-valued expression.
At line:7 char:1
+ $qw = $ie.document.getElementById("overridelink");
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:8 char:1
+ $qw.click();
+ ~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Kindly Help!!
User contributions licensed under CC BY-SA 3.0