2016-04-06 19 views
-5

Oturum açma ekranı için web_browser.document.getElementById() yöntemini kullanıyorum, ancak oturum açma ve oturum açtıktan sonra yeni bir pencere açıldığında web_browser.document.getElementById işe yaramıyor lütfen yardım edin. kod aşağıda bulabilirsiniz:Yeni pencerenin elemanını alma ve java betiği için değer atama

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 
+0

daha detaylı bilgi veriniz. – Scriptlabs

cevap

0

böyle bir şey kullanmak, sen ComObjCreate kullanarak yaratmadı mevcut Internet Explorer pencerelerini erişmek için:

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 {} 
} 
0
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