Hi, Everybody
These days, I have been learnt to Automate Internet Explorer. But, When I comes to get the element in frame/iframes at different domains, errors come out:ACCESSDENIED.And my method is:
objIE := WBGET()
objIE.document.frames["xxxx"].frames["xxxx"].document.getElementById........
this works when frames froms same domain, fail if froms different domain.
Any ideals will be helpful, sorry for my bad english.Thanks!
Cann't access to frame at different domain when automate IE Topic is solved
Re: Cann't access to frame at different domain when automate IE Topic is solved
you have to query for the document object from the documentElement
Havent tested or done this in a while but that is what i recal
Code: Select all
IHTMLWindow2_from_IWebDOCUMENT( IWebDOCUMENT )
{
static IID_IHTMLWindow2 := "{332C4427-26CB-11D0-B483-00C04FD90119}" ; IID_IHTMLWindow2
return ComObj(9,ComObjQuery( IWebDOCUMENT, IID_IHTMLWindow2, IID_IHTMLWindow2),1)
}
Code: Select all
frameDoc := IHTMLWindow2_from_IWebDOCUMENT( objIE.document.frames["xxxx"].documentElement )
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
Re: Cann't access to frame at different domain when automate IE
thanks, I will try this out!tank wrote: ↑11 Apr 2019, 11:12you have to query for the document object from the documentElementCode: Select all
IHTMLWindow2_from_IWebDOCUMENT( IWebDOCUMENT ) { static IID_IHTMLWindow2 := "{332C4427-26CB-11D0-B483-00C04FD90119}" ; IID_IHTMLWindow2 return ComObj(9,ComObjQuery( IWebDOCUMENT, IID_IHTMLWindow2, IID_IHTMLWindow2),1) }
Havent tested or done this in a while but that is what i recalCode: Select all
frameDoc := IHTMLWindow2_from_IWebDOCUMENT( objIE.document.frames["xxxx"].documentElement )
Re: Cann't access to frame at different domain when automate IE
Thanks,tank. Your code works nice.I have three frames at different domains,this is my code:
Code: Select all
rightFrameDoc := IHTMLWindow2_from_IWebDOCUMENT(objIE.document.frames["rightFrame"].document)
mainFrameDoc := IHTMLWindow2_from_IWebDOCUMENT(rightFrameDoc.frames["mainFrame"].document)
num := mainFrameDoc.document.frames["chiframe"].document.getElementById("capitalFl").Click()
Re: Cann't access to frame at different domain when automate IE
glad it helped
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
Who is online
Users browsing this forum: Bing [Bot], Google [Bot], JKJadan, moltenchees, Psych0p4th and 269 guests