2014-01-27 16 views
2

在成功登錄到網頁「https://v-tri.tri.co.id:8434/insms/dealer/en/loginin.do」,我得到由三幀新的頁面「https://v-tri.tri.co.id:8434/insms/dealer/en/Recharge.do?case.menuid=050116如何在twebbrowser中填充框架中的任何字段?

如何填寫位於從我的節目(Delphi7中)第三幀領域

[這是討論「Login to web using TWebBrowser」的延續]

我已經試過這一點,但沒有奏效:

WebBrowser1.OleObject.Document.GetElementByID('fieldname').setAttribute('value', edit1.Text); 
WebBrowser1.OleObject.Document.GetElementByID('fieldname').setAttribute('value', edit2.Text); 
+0

這個問題看起來像重複:http://stackoverflow.com/questions/21298196/login-to-web-using-twebbrowser但與較少的細節 - 我錯過了什麼? – Flexo

+0

@Flexo,這似乎是更進一步。登錄後。但原則是一樣的。 – TLama

+0

是的,我需要一個解決方案來繼續我的程序尚未完成,但我真的不知道下一個代碼,誰願意幫助sy會非常感謝他的幫助,如果需要用戶名和密碼,他會 ,我會給 非常感謝你 – user3226004

回答

1

你是在正確的軌道上。你根本沒有考慮到框架。 OleObject.Document代表主窗口。它有一個frames集合,而集合中的每個元素都有自己的contentDocument對象,如:

WebBrowser1.OleObject.Document.frames.item(2).contentDocument.GetElementByID('fieldname').setAttribute('value', edit1.Text); 
+0

以及,我已經嘗試過,但沒有管理我得到了一個消息錯誤「項目引發異常類Vtri.exe EOleSysError與消息'未實現'。過程停止。 對不起,先生,如果我問了很多,如果我的英語不好,我很抱歉,我仍然是一名學生:) – user3226004

+0

究竟是哪個屬性?將語句分解成更小的任務:'doc:= ... OleObject.Document; frames:= doc.frames; frame:= frames.item(2);'等等。我個人從不使用'TWebBrowser.OleObject'。我查詢'TWebBrowser.Document 'IHTMLDocument2'接口,然後直接訪問DOM接口,而不涉及'IDispatch'開銷。 –

+0

我不知道如何使用Delphi訪問網頁,我只是想在框架中填寫「MSISDN」和其他字段的文本框,無論使用什麼手段,因爲我一直在努力工作,從我的所有這些任務學校, 並沒有得到結果 – user3226004

-2

已經回答這個問題 WebBrowser1.OleObject.Document.Frames.Item(2)。 Document.getElementById('id')。 SetAttribute('value',edit3.Text); WebBrowser1.OleObject.Document.Frames.Item(2)。 Document.getElementById('id')。 SetAttribute('value','0'); 感謝所有幫助過的人。

相關問題