Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何获取新窗口的元素并在java脚本中赋值_Javascript_Jquery_Autohotkey - Fatal编程技术网

Javascript 如何获取新窗口的元素并在java脚本中赋值

Javascript 如何获取新窗口的元素并在java脚本中赋值,javascript,jquery,autohotkey,Javascript,Jquery,Autohotkey,我使用web_browser.document.getElementById()作为登录屏幕,它可以正常工作,但是当登录web_browser.document.getElementById并在登录后打开新窗口时,它似乎不起作用,请帮助。请查找以下代码: My_User_Name := "My_User_Name" My_Pass_Word := "My_User_Name" My_Batch := "C1-ADMOV" web_browser := ComObjCreate("Inter

我使用web_browser.document.getElementById()作为登录屏幕,它可以正常工作,但是当登录web_browser.document.getElementById并在登录后打开新窗口时,它似乎不起作用,请帮助。请查找以下代码:

My_User_Name := "My_User_Name"

My_Pass_Word := "My_User_Name"

My_Batch := "C1-ADMOV"

web_browser := ComObjCreate("InternetExplorer.Application")

web_browser.Visible := true

web_browser.Navigate("http://example.com")

while web_browser.busy ; a while loop is a way to keep the script testing an IF like expression

sleep 100 ; IF web_browser.busy is true then sleep 100 milliseconds


username_input := web_browser.document.getElementById("userId")

username_input.value := My_User_Name

password_input := web_browser.document.getElementById("password")

password_input.value := My_Pass_Word


web_browser.document.getElementById("loginButton").click()


while web_browser.busy ; a while loop is a way to keep the script testing an IF like expression

sleep 100 ; IF web_browser.busy is true then sleep 100 milliseconds


web_browser.Navigate2("http://example.com/batches")


while web_browser.busy ; a while loop is a way to keep the script testing an IF like expression

sleep 1000 ; IF web_browser.busy is true then sleep 1000 milliseconds


BATCH_CD_input := web_browser.document.getElementById("BATCH_CD")

BATCH_JOB_ID_input := web_browser.document.getElementById("BATCH_JOB_ID")

BATCH_CD_input.value := My_Batch

BATCH_JOB_ID_input.value:= "96090087688130"

web_browser.document.getElementById("lIM_Altr_bjSrch").click()

web_browser.document.getElementById("IM_Main_batjobSrch").click()

web_browser.document.getElementById("ACTION_Q_SW").click()


Return

要访问您没有使用
ComObjCreate
创建的现有Internet Explorer窗口,请使用以下命令:

web_browser_from_active_window := IeGet()
web_browser_2 := IeGet("Login site bla bla")

IeGet(winTitle:="A") {
    WinGetTitle, title, % winTitle
    For window in ComObjCreate("Shell.Application").windows
        If (InStr(window.fullName, "iexplore.exe") && window.document.title . " - Internet Explorer" = title)
            Return window
    Return {}
}

请提供更多细节。
I managed to get elements I want on webpage. What I did instead of navigating to login page and enter credentials, I just navigate to the webpage I want to get elements in. I only have web_browser.Navigate2("http://example.com/batches"). This sorted my issue 


 My_User_Name := "My_User_Name"

My_Pass_Word := "My_User_Name"

My_Batch := "C1-ADMOV"

web_browser := ComObjCreate("InternetExplorer.Application")

web_browser.Visible := true

web_browser.Navigate2("http://example.com/batches")

while web_browser.busy ; a while loop is a way to keep the script testing an IF like expression

sleep 100 ; IF web_browser.busy is true then sleep 100 milliseconds


username_input := web_browser.document.getElementById("userId")

username_input.value := My_User_Name

password_input := web_browser.document.getElementById("password")

password_input.value := My_Pass_Word


web_browser.document.getElementById("loginButton").click()


while web_browser.busy ; a while loop is a way to keep the script testing an IF like expression

sleep 100 ; IF web_browser.busy is true then sleep 100 milliseconds


while web_browser.busy ; a while loop is a way to keep the script testing an IF like expression

sleep 1000 ; IF web_browser.busy is true then sleep 1000 milliseconds


BATCH_CD_input := web_browser.document.getElementById("BATCH_CD")

BATCH_JOB_ID_input := web_browser.document.getElementById("BATCH_JOB_ID")

BATCH_CD_input.value := My_Batch

BATCH_JOB_ID_input.value:= "96090087688130"

web_browser.document.getElementById("lIM_Altr_bjSrch").click()

web_browser.document.getElementById("IM_Main_batjobSrch").click()

web_browser.document.getElementById("ACTION_Q_SW").click()


Return