我需要使用Autohotkey单击登录的帮助

时间:2019-05-24 09:56:49

标签: dom com autohotkey

我正在尝试自动登录到我的公司网站,该网站每天都会启动我需要的程序之一,但是我找不到找到页面登录方式,

我尝试了很多不同的事情,因此不可能一一列举,但其中有些包括

wb.document.getElementById("login").Click
wb.document.getElementById("OraButton left").Click
wb.document.getElementByClassName("OraButton left").Click

这是我的代码,可以正常工作

wb := IEGet("Login") ;Tab name you define can also be a variable
wb.document.getElementById("usernameField").value := Loginname
wb.document.getElementById("passwordField").value := Password

IEGet(Name="")        ;Retrieve pointer to existing IE window/tab
{
    IfEqual, Name,, WinGetTitle, Name, ahk_class IEFrame
        Name := ( Name="New Tab - Windows Internet Explorer" ) ? "about:Tabs"
        : RegExReplace( Name, " - (Windows|Microsoft) Internet Explorer" )
    For wb in ComObjCreate( "Shell.Application" ).Windows
        If ( wb.LocationName = Name ) && InStr( wb.FullName, "iexplore.exe" )
            Return wb
} ;written by Jethrow

但是我似乎无法弄清楚如何调用登录提交表单

        <form id="login" action="javascript:submitCredentials();" method="post" autocomplete="off">
        <div class="control_box min_margin" id="UsernameBox">
            <label title="User Name" for="usernameField" message="FND_SSO_USER_NAME">User Name</label>
            <input name="usernameField" tabindex="0" class="inp" id="usernameField" type="text" value="" message="FND_SSO_USER_NAME">

        </div>

                <div class="control_box min_margin" id="logoutLink" style="display: none;"><a name="logout" tabindex="0" title="Not ?  Log Out" onclick="confirmLogout()" message="FND_SSO_NOTSAME_USER">Not ?  Log Out</a></div>
        <div class="control_box min_margin">
            <label title="Password" for="passwordField" message="FND_SSO_PASSWORD">Password</label>
            <input name="passwordField" tabindex="0" class="inp" id="passwordField" type="password" value="" message="FND_SSO_PASSWORD">
        </div>
        </form>
        <div class="control_box center" id="ButtonBox">

            <button tabindex="0" class="OraButton left" style="padding-right: 6px; padding-left: 6px;" onclick="submitCredentials()" message="FND_SSO_LOGIN">Login</button>
            <button tabindex="0" class="OraButton right" style="padding-right: 6px; padding-left: 6px;" onclick="handleCancel()" message="FND_SSO_CANCEL">Cancel</button>
        </div>

到目前为止,脚本已填写用户名和密码,但随后停止 我希望它提交用户名和密码,

如果有人能帮助我,我将非常感激,我已经花了数小时在圈子里转,并且用光了我会尝试的东西

预先感谢

编辑: 多亏了Evan Elrod提供的链接,我才能够找到“ wb.document.getElementsByTagName(” form“).Submit()”,这使代码对我有用(https://www.autohotkey.com/boards/viewtopic.php?t=21091

0 个答案:

没有答案