powershell - $ie.document 方法对于 powershell 中的控制台页面不可见
问题描述
我正在使用 powershell 自动登录页面,但是当我导航到登录控制台页面时,没有 $ie.document 方法可见。并显示空错误。控制台页面存在的方法是:
CreateObjRef 等于
GetHashCode
GetLifetimeService
GetType
InitializeLifetimeService
ToString
我使用的代码是:-
$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();
错误:- 您不能在空值表达式上调用方法。
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
请帮助!
解决方案
推荐阅读
- ajax - Magento 2 中的 XMLHttpRequest/AJAX 文件上传适用于 Chrome,但不适用于 Firefox
- ruby - CIS 基准合规性转换为 ruby 脚本
- java - 将 Swagger Basic AUTH 添加到 Spring Boot 应用程序
- mysql - 从mysql中两个参数满足的表中选择
- sql - Oracle SQL - 根据唯一行删除条目
- angular - mat-menu 样式未在 Angular 中应用
- azure - 从 ARM 模板创建 Azure Web 应用插槽,无需复制原始 Web 应用配置
- c++ - 互斥错误会引发异常吗?
- android - 自动调整初始屏幕图像
- django - Django 填充用户模型扩展/配置文件模型