Failproof Wait for IE to load

后端 未结 6 1878
滥情空心
滥情空心 2020-11-29 08:49

Is there a foolproof way for the script to wait till the Internet explorer is completely loaded?

Both oIE.Busy and / or oIE.ReadyState are

6条回答
  •  悲&欢浪女
    2020-11-29 09:28

    try to put this script on the top, this may solve Your problem.

    { 
        $myWindowsID = [System.Security.Principal.WindowsIdentity]::GetCurrent();
        $myWindowsPrincipal = New-Object System.Security.Principal.WindowsPrincipal($myWindowsID);
        $adminRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator;
    
        if ($myWindowsPrincipal.IsInRole($adminRole)) {
            $Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)";
            Clear-Host;
        }
        else {
            $newProcess = New-Object System.Diagnostics.ProcessStartInfo "PowerShell";
            $newProcess.Arguments = "& '" + $script:MyInvocation.MyCommand.Path + "'"
            $newProcess.Verb = "runas";
            [System.Diagnostics.Process]::Start($newProcess);
            Exit;
        }
    }
    

    Explanation:

    Powershell is not having some rights when you are running script from the normal mode so it is not reading IE status properly and that is why DOM is not being loaded so, script doesn't found any parameter

提交回复
热议问题