Results 1 to 9 of 9

Thread: [RESOLVED] "WebBrowser1.Document.documentelement.innertext" not show all data of diff Frame/form

  1. #1

    Thread Starter
    Lively Member nilesh16782's Avatar
    Join Date
    Feb 2007
    Location
    India
    Posts
    104

    Resolved [RESOLVED] "WebBrowser1.Document.documentelement.innertext" not show all data of diff Frame/form

    hi..
    in vb6 i use this code to view data of web page..
    "WebBrowser1.Document.documentelement.innertext"

    But this code not show all data of all frames/ forms of webpage..

    so what i do..??????????

  2. #2
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: "WebBrowser1.Document.documentelement.innertext" not show all data of diff Frame/form

    Frames and IFrames are seperate HTML documents. They are not included with the main document; only their tags are included.

    To address HTML code and text data in a frame you must address the frame element itself.

    Didn't I show you this in another thread?

    http://www.vbforums.com/showthread.php?t=558787

    post #10, 1st code line
    Last edited by jmsrickland; Feb 27th, 2009 at 08:49 AM.

  3. #3

    Thread Starter
    Lively Member nilesh16782's Avatar
    Join Date
    Feb 2007
    Location
    India
    Posts
    104

    Re: "WebBrowser1.Document.documentelement.innertext" not show all data of diff Frame/form

    your means if a webpage contain N different frames then we can't know innertext of those N frame by single function..??

    By this code know any specific frame's data
    "WebBrowser1.Document.frames(i).Document.documentelement.innertext"

    but if i use this code to know data of a webpage (which contain data in more than one frame) this it is not clear that how many time i execute this code..?? for frame-1, frame-2 , frame-2....frame-n
    where n=?? (not know for different website)
    Last edited by nilesh16782; Feb 28th, 2009 at 08:52 AM.

  4. #4
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284

    Re: "WebBrowser1.Document.documentelement.innertext" not show all data of diff Frame/form

    The .innerText property contains the textural content of your page, excluding the html tags. If you just want to see the html tags, including the form's content, you have to use the .innerHtml or .outerHtml properties.

    Use the For Each syntax to get each frames your page have.

    Code:
    Dim oFrame as Object
      For Each oFrame in WebBrowser1.Document.frames
       'oFrame will be one single frame, that you can use to extract/modify its content
       debug.print oFrame.innerHtml
      Next
    However, i'm not exactly sure about the syntax of frames() object, but i hope this works.

  5. #5
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: "WebBrowser1.Document.documentelement.innertext" not show all data of diff Frame/form

    Here's a simple sample to experiment with. If you don't know the name of the frame thenuse it's index value instead. This example shows you how to get the HTML of a frame. I think with a little effort and forthought on your part you should be able to figure out how it works
    Attached Files Attached Files
    Last edited by jmsrickland; Mar 1st, 2009 at 03:33 AM.

  6. #6

    Thread Starter
    Lively Member nilesh16782's Avatar
    Join Date
    Feb 2007
    Location
    India
    Posts
    104

    Thumbs up Re: "WebBrowser1.Document.documentelement.innertext" not show all data of diff Frame/form

    Quote Originally Posted by Jim Davis
    Code:
    Dim oFrame as Object
      For Each oFrame in WebBrowser1.Document.frames
       'oFrame will be one single frame, that you can use to extract/modify its content
       debug.print oFrame.innerHtml
      Next
    However, i'm not exactly sure about the syntax of frames() object, but i hope this works.
    yaaaaaa.....This is right way to do...

    but ths code generate error
    "Object doesn't support this property or method"

  7. #7

    Thread Starter
    Lively Member nilesh16782's Avatar
    Join Date
    Feb 2007
    Location
    India
    Posts
    104

    Re: "WebBrowser1.Document.documentelement.innertext" not show all data of diff Frame/form

    Quote Originally Posted by jmsrickland
    Here's a simple sample to experiment with. If you don't know the name of the frame thenuse it's index value instead. This example shows you how to get the HTML of a frame. I think with a little effort and forthought on your part you should be able to figure out how it works
    Thank you .. for this example...
    this example do all the things which i needed...

    In this example can i put a button which can show all three frames innertext...
    by using loop like

    dim f as object
    For each f in madocument.document.frames
    'code
    next


    ??

  8. #8
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: "WebBrowser1.Document.documentelement.innertext" not show all data of diff Frame/form

    I was only able to get this to work. Add this code to a Button control to the project I gave you in that zip file.
    Code:
       '
       '
    For i = 0 To WebBrowser1.Document.frames.length - 1
      Frames_HTML = WebBrowser1.Document.frames(i).Document.documentElement.innerHTML
      Form2.Text1.Text = Frames_HTML
      Form2.Caption = "Frame Page HTML Source"
      Form2.Show
      MsgBox "Click OK to see next frame HTML"
    Next
       '
       '
    Last edited by jmsrickland; Mar 1st, 2009 at 04:46 PM.

  9. #9

    Thread Starter
    Lively Member nilesh16782's Avatar
    Join Date
    Feb 2007
    Location
    India
    Posts
    104

    Re: "WebBrowser1.Document.documentelement.innertext" not show all data of diff Frame/form

    yaaaaaaahhhhhhhhh...it is right....
    Ok... thanks my problem now Resolved...
    Thank again...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width