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

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

问题描述

所以,我是新来的PowerShell。我已经建立了一个有趣的几个剧本,但卡住了上一个,我似乎并没有能够弄清楚。我试图自动化继续按钮的点击,但不知道该怎么办。我已经试过所有我能想到的。任何想法?

  $用户名='用户名'$密码='密码'$即=新对象-ComObjectinternetExplorer.Application
$ ie.Visible = $真
$ ie.Navigate(https://www.ksl.com/public/member/signin?login_forward=%2F)而($ ie.Busy -eq $真){启动休眠-seconds 1;}$ usernamefield = $ ie.Document.getElementByID('memberemail')
$ usernamefield.value = $用户名$ passwordfield = $ ie.Document.getElementByID('memberpassword')
$ passwordfield.value = $密码$链接= $ ie.Document.getElementsByTagName(输入)|其中,对象{$ _。键入-eq继续}
$ Link.click()


解决方案

的问题是,该对象的类型是图片,无法继续。类名是继续。尝试在code这条线,看看是否对你的作品:

  $链接= $ ie.Document.getElementsByTagName(输入)|其中,对象{$ _。的className -eq继续}

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()

解决方案

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天全站免登陆