Powershell如何修复/编程自动记录"属性'值'在这个物体上找不到"

时间:2016-11-21 16:33:39

标签: powershell powershell-v2.0

早上好

我是Powershell的新手并且练习如何编码。

我尝试制作自动记录系统。

My Power Shell版本:2.0。

感谢这个人。

https://gallery.technet.microsoft.com/scriptcenter/Open-Internet-Explorer-e4f8ae4b

# Invoke Internet Explorer 

$IE = New-Object -com internetexplorer.application; 
$IE.visible = $true; 
$IE.navigate($Url); 

# Wait a few seconds and then launch the executable. 

while ($IE.Busy -eq $true) 

{ 

Start-Sleep -Milliseconds 2000; 

} 

$IE.Document.getElementById(“username”).value = $Username 
$IE.Document.getElementByID(“password”).value=  $Password 
$IE.getElementsByClassName("btnLogin").Click()

我有两个错误,我不知道如何修复

一个是

"财产'价值'在这个对象上找不到;确保它存在且可以设置。"

$IE.Document.getElementById(“username”).value = $Username 
$IE.Document.getElementByID(“password”).value=  $Password 

我正在使用谷歌浏览器并左键单击"检查"在框中,看到"用户名"和#34;密码"在ID上

另一个是

财产'价值'在这个对象上找不到;确保它存在并且可以设置。

$IE.getElementsByClassName("btnLogin").Click()

由于没有ID = .....所以我采取了#34;输入类=" btnLogin"

导致错误,我该如何解决这些问题?

由于

0 个答案:

没有答案