简体   繁体   English

网站中的autohotkey下拉选择不起作用

[英]autohotkey dropdown selection in a website not working

I am working on a auto hot key script that can automate a drop down selection. 我正在研究可以自动执行下拉选择的自动热键脚本。 I do not know what is happening but it seems to be failing. 我不知道发生了什么,但似乎失败了。 I have tried various method of getting it to read the information to the point of just adding a default value and it still will not change the value of the dropdown box. 我尝试了多种获取信息的方法,只需添加默认值,它仍然不会更改下拉框的值。

Here is the start of the code. 这是代码的开头。

url:= "first page"
URLElegibility := "Second Page"
counter := 0

Sleep 9000
; create ie instance
ie := ComObjCreate("InternetExplorer.Application")
ie.Visible := true  ; This is known to work incorrectly on IE7.

loginHL(url) ;login to the website
Sleep 2000 
SigningIn() ;Sign into site
loginHL(URLElegibility) ; log into second site this just pushes the site to go to a second link

selectObj := ie.document.getElementById("payerDropDown").options
Sleep 2500

selectItem := "bad"
While !(InStr(selectItem,"Value to Get")) ;
{
index := A_Index
selectItem := selectObj[A_Index].text

MsgBox "Error is here it goes on a infinite loop trying to find the value to get"
}
index := selectObj[index].value
ie.document.getElementById("payerDropDown").value := index

I tried these methods next to change the dropdown with no success. 我接下来尝试使用这些方法来更改下拉列表,但没有成功。

MsgBox "Slelected value"
ie.document.getElementById("payerDropDown").focus()
ie.document.getElementById("payerDropDown").value := 4
ie.document.getElementById("payerDropDown").value = 4
Sleep 2500
MsgBox "Slelected index"
ie.document.getElementById("payerDropDown").focus()
ie.document.getElementById("payerDropDown").selectedIndex = 1
ie.document.getElementById("payerDropDown").selectedIndex := 4
Sleep 2500

I am not sure what I am doing wrong here. 我不确定我在做什么错。 I am looking at the tutorials and this should be working. 我正在看教程,这应该可以工作。 Anyone with any advice on what I am missing or doing wrong ? 有人对我缺少或做错的事情有任何建议吗?

Well what ended up happening is that the web page uses forms. 嗯,最终发生的事情是网页使用表格。 I was able to target the internal page within the form and from there fill out the information. 我能够定位表单中的内部页面,然后从那里填写信息。 Hard to believe that these html forms can be a small pain. 很难相信,这些html形式可能会有些痛苦。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM