不以表单形式发送给网页的用户名和密码? [英] How to send to username and password to webpage when it is not as form?
本文介绍了不以表单形式发送给网页的用户名和密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从自动脚本向Web应用程序发送用户名和密码.
I am trying to send username and password to web application from autoit script.
$oIE.document.getElementsByName($formUID).Item(0).value = $Name
$oIE.document.getElementById($formPID).value = $pwd
以上这些功能在Windows 7中有效,但在Windows 8和IE 10中无效.有人可以帮助我吗?这很重要.
These functions above are working in Windows 7 but not working in Windows 8 and IE 10. Can any one help me? It's very important.
推荐答案
如果这些字段具有ID或NAME,则应使用
If those fields have ID or NAME you should use
Local $oUsername = _IEGetObjById($oIE, "Username") ; _IEGetObjById or _IEGetObjByName
$oUsername.value = "myusername"
如果它们没有,那么您可以列出所有元素并对它们进行比较. 您可以使用:
IF they dont, then you can list all elements and do a comparison on them. You can use:
$oInput.type
$oInput.Id
$oInput.name
$oInput.classname
$oInput.innerhtml
$oInput.outerhtml
$oInput.innertext
$oInput.outertext
etc...
用法示例:
Local $oInputs = _IETagNameGetCollection($oIE, "input")
For $oInput In $oInputs
if $oInput.type == "password" then $oInput.value = "mypassword"
if $oInput.name == "username" then $oInput.value = "myusername"
Next
如果仍然无法正常运行,请尝试使用嵌入式IE.如果可以,但是您需要常规的IE, 考虑使用兼容模式:
If it still doesn't work, try using embedded IE. If that works but you need regular IE, Consider using Compatibility mode:
$64Bit = ""
If @OSArch = "X64" Then
$64Bit = "64"
EndIf
If StringLeft(RegRead("HKLM" & $64Bit & "\SOFTWARE\Microsoft\Internet Explorer\Version Vector", "IE"), 1) > 8 Then ;Check for version 9 or later
$wshNetwork = ObjCreate("WScript.Network")
$struser = $wshNetwork.Username
$objWMIService = ObjGet("winmgmts:\\.\root\cimv2")
$objAccount = $objWMIService.Get('Win32_UserAccount.Name="' & $struser & '",Domain="' & @ComputerName & '"')
RegWrite("HKU" & $64Bit & "\" & $objAccount.SID & "\Software\Microsoft\Internet Explorer\BrowserEmulation\", "AllSitesCompatibilityMode", "REG_DWORD", 1)
RegWrite("HKU\" & $objAccount.SID & "\Software\Microsoft\Internet Explorer\BrowserEmulation\", "AllSitesCompatibilityMode", "REG_DWORD", 1)
EndIf
这篇关于不以表单形式发送给网页的用户名和密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文