我正在尝试创建一个Powershell脚本,将Internet Explorer打开到IP电话的IP地址,输入用户信用,登录,然后单击重新启动选项。
我遇到了让脚本超越打开Web门户的问题。这是我的Powershell脚本。
<#
Created: November 8, 2017
Version 1.0
Description: Launch Internet Explorer to the specified URL, log into the site, and then click the reboot command on the page.
Notes:
#>
#Set-ExecutionPolicy RemoteSigned
# Edit this to be the URL or IP address of the site to be launched
$Url = "10.0.4.239"
# Edit this to be the UserName
$Username = "admin"
# Edit this to be the corresponding Password
$Password = "admin"
# Invoke Internet Explorer
$IE = New-Object -com internetexplorer.application;
$IE.Visible = $true;
$IE.navigate($url);
# Wait a few secconds for the page to load
while ($IE.Busy -eq $true)
{
Start-Sleep -Seconds 4;
}
<#
The following UsernameElement, PasswordElement, and LoginElement need to be modified first.
#>
$IE.Document.getElementByClassName("gwt-TextBox").value = $username;
$IE.Document.getElementByClassName("gwt-PasswordTextBox").value = $Password;
$IE.Document.getElementByClassName("gwt-Button").Click();
do
{
Sleep 25
}
while ($ie.Busy -eq "True")
以下是我收到的错误的屏幕截图。
以下是输入字段和登录按钮的源代码。
感谢您的帮助。