List Info

Thread: Accessing content in a sub frame




Accessing content in a sub frame
user name
2006-05-23 21:34:16
 
I am trying to write a Greasemonkey script for a frameset
page and would
like to access the content in a subframe.  I'm having
trouble
constructing an XPath that will take me from the frameset
page down into
the subframe page.  The XPath into the frameset page is:
/html/frameset/frameset/frame[1] and the XPath into the
subframe is:
/html/body/p[1]/a[1].  How does one stitch these two
together so I can
write a single XPath from the frameset page right down into
the subframe
page?

Thanks, Terry

Terrence A. Brooks
The Information School
The University of Washington
Box 352840
Seattle, WA 98195-2840
Voice: 206 546-5707
Fax: 206 616-3152
HTTP://faculty.washington.edu/tabrooks/ 

_______________________________________________
Greasemonkey mailing list
Greasemonkeymozdev.org
http:
//mozdev.org/mailman/listinfo/greasemonkey
Accessing content in a sub frame
user name
2006-05-23 21:54:33
Hello Terry,

On 5/23/06, Terry Brooks <tabrooksu.washington.edu> wrote:
>
>
> I am trying to write a Greasemonkey script for a
frameset page and would
> like to access the content in a subframe.  I'm having
trouble
> constructing an XPath that will take me from the
frameset page down into
> the subframe page.  The XPath into the frameset page
is:
> /html/frameset/frameset/frame[1] and the XPath into the
subframe is:
> /html/body/p[1]/a[1].  How does one stitch these two
together so I can
> write a single XPath from the frameset page right down
into the subframe
> page?
>

I don't think you can access the content of a sub-frame
with an XPath like
that.

You probably have to use something like....

var iframe_element =
document.getElementById("the-id-of-the-iframe");

var iframe_document = iframe_element.contentWindow.document;

And then once you have the "document" of that
iframe then you can apply you
XPath's to that.


See ya

-- 
    Charles Iliya Krempeaux, B.Sc.

    charles  reptile.ca
    supercanadian  gmail.com

    developer weblog: http://ChangeLog.ca/
____________________________________________________________
_______________
 Make Television                                http://maketelevision.com/

_______________________________________________
Greasemonkey mailing list
Greasemonkeymozdev.org
http:
//mozdev.org/mailman/listinfo/greasemonkey
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )