powershell autologin webapplication

时间:2016-09-30 06:51:47

标签: html powershell

我的问题是一台自动登录到infopanel Web应用程序的计算机。一切都按照脚本编写,直到提交凭据 - Web应用程序在浏览器中启动,用户名和密码填写,但未提交 - 通过按下登录按钮移交给应用程序。

我已将下面的Web应用程序的部分登录源代码放在:

<div class="editor-submit">
<input class="k-button" type="submit" value="Login" />
</div>

处理自动登录的powershell脚本如下:

$Url = “http://crm-mobile:8080/Account/Login?ReturnUrl=%2f”
$Username=”xxx”
$Password=”yyy”
$IE = New-Object -com internetexplorer.application;
$IE.visible = $true;
$IE.navigate($url);

while ($IE.Busy -eq $true)
{
Start-Sleep -Milliseconds 2000;
}
$IE.Document.getElementById(“Username”).value = $Username
$IE.Document.getElementById(“Password”).value = $Password
$IE.Document.getElementsByTagName("k-button") |
? { S_.Type -eq 'submit' -and S_.value -eq "Login" } |
% { S_.Click() }
while ($IE.Busy -eq $true)
{
Start-Sleep -Milliseconds 2000;
}

有人可以帮我找到解决这个自动登录问题的工作方案吗?提前很多,

亲切的问候,

理查德

0 个答案:

没有答案