簡體   English   中英

網站中的autohotkey下拉選擇不起作用

[英]autohotkey dropdown selection in a website not working

我正在研究可以自動執行下拉選擇的自動熱鍵腳本。 我不知道發生了什么,但似乎失敗了。 我嘗試了多種獲取信息的方法,只需添加默認值,它仍然不會更改下拉框的值。

這是代碼的開頭。

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

我接下來嘗試使用這些方法來更改下拉列表,但沒有成功。

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

我不確定我在做什么錯。 我正在看教程,這應該可以工作。 有人對我缺少或做錯的事情有任何建議嗎?

嗯,最終發生的事情是網頁使用表格。 我能夠定位表單中的內部頁面,然后從那里填寫信息。 很難相信,這些html形式可能會有些痛苦。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM