Powershell网站自动化按钮点击登录 [英] Powershell website automating button click on login

查看:55
本文介绍了Powershell网站自动化按钮点击登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我是 powershell 的新手.我已经构建了一些有趣的脚本,但卡在了一个我似乎无法弄清楚的脚本上.我正在尝试自动点击继续"按钮,但不知道该怎么做.我已经尝试了所有我能想到的.有什么想法吗?

So I'm new to powershell. I've built a few scripts for fun but got stuck on one that I don't seem to be able to figure out. I'm trying to automate the clicking of the "Continue" button but don't know what to do. I have tried everything I can think of. Any ideas?

$username='username' 
$password='password'

$ie = New-Object -ComObject 'internetExplorer.Application'
$ie.Visible= $true
$ie.Navigate("https://www.ksl.com/public/member/signin?login_forward=%2F")

while ($ie.Busy -eq $true){Start-Sleep -seconds 1;}   

$usernamefield = $ie.Document.getElementByID('memberemail')
$usernamefield.value = $username

$passwordfield = $ie.Document.getElementByID('memberpassword')
$passwordfield.value = $password

$Link=$ie.Document.getElementsByTagName("input") | where-object {$_.type -eq "continue"}
$Link.click()

推荐答案

问题是对象的Type是Image,不能继续.ClassName 是继续.在该代码中尝试这一行,看看它是否适合您:

The problem is that the object's Type is Image, not continue. The ClassName is continue. Try this line in that code and see if that works for you:

$Link=$ie.Document.getElementsByTagName("input") | where-object {$_.className -eq "continue"}

这篇关于Powershell网站自动化按钮点击登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆