Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

COM_Invoke Frames[]


  • Please log in to reply
9 replies to this topic
ecksphore
  • Members
  • 252 posts
  • Last active: Jul 20 2015 03:25 AM
  • Joined: 21 Nov 2006
I'm trying to click on a "Close" link - but the link resides in a IFrame.

Could someone please show me how I can click on this?

The iWeb Browser Learner shows :

Frames :
[IFRAME].1 **[sourceIndex]=670 **[name]= f16ab2496edec86 **[id]= fd3d85d417aaf5

Value/InnerText :
Close

OuterHTML :
<SPAN class=CloseWin>Close</SPAN>

I've noticed the "sourceIndex" always changes on browser refresh (not sure if that's important). The Iframe number always stays the same though.

I'm using the standard AHK with the COM library.

ecksphore
  • Members
  • 252 posts
  • Last active: Jul 20 2015 03:25 AM
  • Joined: 21 Nov 2006
Anyone? I could really use help on this.

a4u
  • Guests
  • Last active:
  • Joined: --
AHK Basic:
SpanTags := Com_Invoke(pwb, "document.parentWindow.frames[fd3d85d417aaf5].document.all.tags[span]")
Loop, % Com_Invoke(SpanTags, "length")
	if (Com_Invoke(SpanTags, "item[" A_Index-1 "].innerText") == "Close") {
		Com_Invoke(SpanTags, "item[" A_Index-1 "]click")
		break
	}

AutoHotkey_L:
SpanTags := pwb.document.parentWindow.frames["fd3d85d417aaf5"].document.all.tags("span")
Loop, % SpanTags.length
	if (SpanTags[A_Index-1].innerText == "Close") {
		SpanTags[A_Index-1].click
		break
	}


ecksphore
  • Members
  • 252 posts
  • Last active: Jul 20 2015 03:25 AM
  • Joined: 21 Nov 2006
Thank you.

How would I get the 'sourceIndex', 'name' and 'id' of the iFrame window?

is it something along the lines of ... pwb.document.parentWindow.frames[name].value ?

a4u
  • Guests
  • Last active:
  • Joined: --

How would I get the 'sourceIndex', 'name' and 'id' of the iFrame window?

Just call 'sourceIndex', 'name', or 'id' from the iframe object.

ecksphore
  • Members
  • 252 posts
  • Last active: Jul 20 2015 03:25 AM
  • Joined: 21 Nov 2006
I've tried :

idx1 := COM_Invoke(frame1, "sourceIndex")

But that just gives me a COM error. Am I doing it wrong?

a4u
  • Guests
  • Last active:
  • Joined: --
:? - if that's all your code, you did several things wrong (including not putting you code in code tags)

ecksphore
  • Members
  • 252 posts
  • Last active: Jul 20 2015 03:25 AM
  • Joined: 21 Nov 2006
I've been looking all over this forum last night and I just can't see any real examples on how to do this.

Is there any posts I'm missing?

sinkfaze
  • Moderators
  • 6367 posts
  • Last active: Nov 30 2018 08:50 PM
  • Joined: 18 Mar 2008
Com_Invoke(pwb, "document.parentWindow.frames[fd3d85d417aaf5].sourceIndex)

:?:

ecksphore
  • Members
  • 252 posts
  • Last active: Jul 20 2015 03:25 AM
  • Joined: 21 Nov 2006

Com_Invoke(pwb, "document.parentWindow.frames[fd3d85d417aaf5].sourceIndex)

:?:


Thank you, but it appears the frame ID, name and sourceIndex all change when I refresh the page. It's frustrating.

Is there a way to detect an iframe in the document - and then find the ID, name or sourceIndex that belongs to that iframe?