【发布时间】:2020-10-24 19:14:33
【问题描述】:
我正在尝试获取我找到的这个 powershell 代码,以登录到我的路由器登录页面,但 powershell 给我一个错误提示
- $Form |获取会员
-
~~~~~~~~~~- CategoryInfo : CloseError: (:) [Get-Member], InvalidOperationException
- FullyQualifiedErrorId : NoObjectInGetMember,Microsoft.PowerShell.Commands.GetMemberCommand
这里是代码
# 发现所有要使用的页面/表单和元素
$url = 'http://192.168.8.1/#/login'
($FormElements = Invoke-WebRequest -Uri $url -SessionVariable fe)
($Form = $FormElements.Forms[0]) |格式列表-强制
$表格 |获取会员
$Form.Fields
# 与网站页面交互
$password = '我的密码'
$loginUrl = 'http://192.168.8.1/#/login'
$ie = New-Object -com internetexplorer.application
$ie.visible = $true
$ie.navigate($loginUrl)
while ($ie.Busy -eq $true) { 开始睡眠 -Seconds 1 }
($ie.document.getElementById('gl-input loginInput') |
选择 -first 1).value = $password
开始-睡眠-秒 1
$ie.Document.getElementsByName('new-password').Item().Click();
开始-睡眠-秒 1
【问题讨论】:
标签: forms powershell autocomplete element