dcsimg
Results 1 to 11 of 11

Thread: how to access DOM of mozilla and netscape

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2007
    Posts
    5

    how to access DOM of mozilla and netscape

    Hello,

    I want to open webrowsers like IE,mozilla and Netscape and then navigate to website and operate on various web components (like entering text in a edit box, click a link, click a button etc). I have accomplished this with IE.


    Code:
    Set BrowserObj = New InternetExplorer
    BrowserObj.Visible = True
    set baseObject=BrowserObj
    
    Set AllButtons = baseObject.document.getElementsByTagName("INPUT")
     
    linkcount = 0
     
    For Each button In AllButtons
    buttonCount = buttonCount + 1
    buttonName = button.Name
    If LCase(Trim(buttonName)) = LCase(Trim(reqButtonName)) Then
    button.Click
    Exit For
    End If
    Next
    how can i do this with firefox and netscape navigator.

    I tried the Mozilla activeX components but thats not what i want. My requirement is to Open firefox , naviagte a url and then operate on the document object. I think to this there has to be a COM component of firefox.

    I searched a lot before posting this quesion and i did find a few similar questions. But the solution was given by making mozilla the default browser and those solutions only dealt with opening the browser and did not deal with the "browser.document" object.

    I have to do this without setting mozilla as default Browser.

    Thanks for reading.

  2. #2
    New Member
    Join Date
    Dec 2008
    Location
    Long Island, NY
    Posts
    9

    Re: how to access DOM of mozilla and netscape

    Have you had any luck? I am also looking for similar routines...

    ... In Addition, I am also trying to determine how to access a pop-up window's contents. For instance:

    I access ieObj.Navigate2 login.html. That page opens a new page/new window once I'm logged in. How can I address the new page's document.body.innerHTML value?

    I was looking for something along the lines of ieObj.Child(0).document.body.innerHTML, but don't see child as a valid parameter to the control.

    Thanks.

  3. #3
    Lively Member
    Join Date
    Jan 2009
    Posts
    73

    Re: how to access DOM of mozilla and netscape

    Looked intensively into all kind of search results but found nothing so far.

    Is there now (after 2 1/2 years from the last post) any way to interface from VB6 to Firefox (or Chrome)
    in a way that is as easy as to interface to Internet Explorer?

    Thanks for all kind of answers.

  4. #4
    PowerPoster
    Join Date
    Jun 2013
    Posts
    4,346

    Re: how to access DOM of mozilla and netscape

    - For what do you want to use these "alternatives to the IE-control"?
    - In what regard is the IE-control lacking?
    - I mean, you say that the interface of the IEControl is easy to use - why change to something else then?

    Olaf

  5. #5
    Lively Member
    Join Date
    Jan 2009
    Posts
    73

    Re: how to access DOM of mozilla and netscape

    Quote Originally Posted by Schmidt View Post
    - For what do you want to use these "alternatives to the IE-control"?
    - In what regard is the IE-control lacking?
    - I mean, you say that the interface of the IEControl is easy to use - why change to something else then?
    Olaf
    1. My program needs to read information from the DOM of defined internet sites
    (obviously there is some handshake between browser and the site therefore simple http-loading is not enough)

    2. I do not use IE any more (performance, security and more) and don't want to install it just for the purpose of the program that has to be developped.


    Are you aware of interfaces for Firefox or Chrome?

  6. #6
    PowerPoster
    Join Date
    Jun 2013
    Posts
    4,346

    Re: how to access DOM of mozilla and netscape

    I still don't really understand why you want to dismiss the IE-control for the more or less simple task "to read information per DOM" (of a few web-sites).

    Sounds not very complicated - and so the IE-engine should suffice IMO (if used in this smaller context directly in a VB-app).

    The other considerations (performance, security) sound as if they have relevance only for "personal browsing", not that much to the VB-project (I also don't use IE in my "daily Web-Surfing" anymore).
    But I may have a wrong impression of what you really want or need.

    However.

    I wrote a VB-Control-wrapper around the latest version of the XulRunner-libs which still supported the mozilla-control (that was in 2011 - a time where this mozilla-version reached about 99% in the Acid2-test, a fast js-engine included) -
    This package comes as a redistributable, in a 10MB large Zip-archive and runs independent of any FireFox-version you might have installed on your System.
    The loading of the mozilla-control and the mozilla-xulrunner-runtime-libs happens regfree in this case - that means that (aside form the VB-wrapper-Control)
    no mozilla-relevant registering-attempts will happen on your machine (so, any existing mozilla-installations will not be affected).
    http://vbRichClient.com/Downloads/mozVB-OCX.zip


    After that I've developed a wrapper around the WebKit-Cairo-engine, which is significantly smaller than the ~10MB above,
    mainly because I finally managed to throw out the large ICU-dependencies from the WebKit C++ sources, writing appropriate
    Unicode-replacements based on the WinAPI instead.

    This smaller engine (3.3MB 7z-compressed and thus the smallest redistributable Browserengine for the Winplatform currently) is an
    (optional) part of the vbRichClient-toolset - and downloadable on this page: http://www.vbrichclient.com/#/en/Downloads.htm

    You might also want to download and register the BaseDlls of that framework, as well as the vbWidgets.dll, in case
    you want to make use of the WebKit-engine in a "visible fashion" (over the cwBrowser-widget which is contained
    in vbWidgets.dll.
    If only "non-visualized, pure DOM-Browsing" is needed, then you will only need the cWebKit-class
    which is already contained in the BaseLibrary of this small VB-Framework (vbRichClient5.dll).

    Olaf

  7. #7
    Lively Member mips's Avatar
    Join Date
    Jan 2011
    Posts
    89

    Re: how to access DOM of mozilla and netscape

    Quote Originally Posted by Schmidt View Post
    I wrote a VB-Control-wrapper around the latest version of the XulRunner-libs
    http://vbRichClient.com/Downloads/mozVB-OCX.zip

    After that I've developed a wrapper around the WebKit-Cairo-engine. ... is an
    (optional) part of the vbRichClient-toolset http://www.vbrichclient.com/#/en/Downloads.htm
    Olaf, Great stuff here. Thanks !
    1) Can you please elaborate if you can use "either" one of your 2 downloads as an independent Firefox ActiveX component ?
    2) Do other additional libraries, or components need to be downloaded and installed for these 2 options to work ?
    3) Does your vbRichClient have to be downloaded and installed as well ?
    4) Do this components can be used just like the WebBrowser IE object did ? And would all existing function references for the WebBrowser, will be able to be used on any of your 2 options ?

    Sorry for the many questions, but wanted to be clear on some of the details
    Thanks again,
    Mips

  8. #8
    PowerPoster
    Join Date
    Jun 2013
    Posts
    4,346

    Re: how to access DOM of mozilla and netscape

    Quote Originally Posted by mips View Post
    1) Can you please elaborate if you can use "either" one of your 2 downloads as an independent Firefox ActiveX component ?
    Only the first one (the 10MB mozilla-ocx-download) is using the "FireFox-" (or correctly: Gecko-) engine" (encapsulated in the XULRunner-library-set of 2011, the last XULrunner-version,
    which still was ABI-compatible and able to work together with the Interfaces of the mozilla-OCX - this XULRunner-set is still a few years more recent than Adam Locke's original here:
    http://www.iol.ie/~locka/mozilla/control.htm).

    Those 10MB contain everything and don't require an "installed FireFox" (and also none of the RichClient-libs).


    The second package is an entirely different animal - it's not based on Gecko, but on WebKit (the WebKit-engine is used
    in Apples Safari-Browser, in Google-Chrome - in Midori or QT-Web.

    Quote Originally Posted by mips View Post
    2) Do other additional libraries, or components need to be downloaded and installed for these 2 options to work ?
    For the 10MB-package with the Mozilla-ocx there's nothing to be downloaded or installed in addition (aside from the VB-OCX-wrapper -
    but this OCX-Project could be transformed into a private UserControl, usable within a VB6-Std-Exe-Project directly, and then no registering would be required).

    The WebKit-package requires the 3 Base-Dlls of the vbRichClient5 (2.2MB zipped - or alternatively 1.6MB as LZMA-compressed 7z-archive)
    The 7z-compressed WebKitCairo-Folder is as said, only 3.3MB - and thus the combination of those
    binaries (e.g. in a LZMA-compressed InnoSetup-package for a "MiniBrowser") would be deployable in under 5MB.
    That's roughly half the deployment-size of the Mozilla-package (*despite* the additional stuff which is already
    contained in the RC5-libs, database-engine and all).

    The WebKit-package is also a bit more recent (2012) than the XULRunner-libs - and understands more HTML5-stuff,
    as e.g. Rounded-corner CSS-styles and CSS-definable gradients.


    Quote Originally Posted by mips View Post
    3) Does your vbRichClient have to be downloaded and installed as well ?
    Yes, in case you want to use the WebKit-package, the RC5-Base-Dlls are needed.
    The WebKitCairo-Folder is an "optional drop-in-folder" which only needs to be placed
    *beside* the 3Base-Dlls (no registering within this WebKitCairo-folder is needed, just treat the whole folder like a "blackbox" and "throw it in there" into the right place):
    \RC5Bin\
    .... vbRichClient5.dll
    .... vb_cairo_sqlite.dll
    .... DirectCOM.dll
    .... \WebKitCairo\ <- this Folder would be (optionally) required, when cWebKit shall be used within an application (or in your own "visual Control"-wrapping-attempt)
    .... vbWidgets.dll <- this'd be needed in addition, when you want to use cWebKit as a "visual Component" (the cwBrowser.cls contains the code which handles cWebKit)


    Quote Originally Posted by mips View Post
    4) Do this components can be used just like the WebBrowser IE object did ? And would all existing function references for the WebBrowser, will be able to be used on any of your 2 options ?
    The mozilla-ocx had the goal, to come up with IE-compatible interfaces - but those were never fully implemented, many remain as stubs only -
    and others behave a little bit different sometimes.

    The WebKit-interfaces are COM-interfaces too - and much richer than the mozilla-interfaces - though not
    compatible to the IE-interfaces.

    But the Events are selfdescribing - and there's a lot of nice ones which are fired ... e.g. regarding your question in the other thread,
    if certain Images can be filtered - yes, of course - any sub-resource on a HTML-page can be filtered-out during the DOM-loading-phase:

    Code:
    Private Sub Browser_DecideAboutResourceLoadRequest(RequestURL As String, Cancel As Boolean)
      Debug.Print "DecideAboutResourceLoadRequest", Left$(RequestURL, 512)
    End Sub
    
    Private Sub Browser_DecidePolicyForMimeType(MimeTypeLeftPart As String, MimeTypeRightPart As String, RequestURL As String, NavPolicy As NavigationPolicyDecision)
      Debug.Print "DecidePolicyForMimeType", MimeTypeLeftPart, MimeTypeRightPart, Left$(RequestURL, 512)
    End Sub
    
    Private Sub Browser_DecidePolicyForNavigation(NavInfo As cNavigationInfo, RequestURL As String, NavPolicy As NavigationPolicyDecision)
      Debug.Print "DecidePolicyForNavigation", Left$(RequestURL, 512)
    End Sub
    So, the WebKit-engine is much more powerful compared with Mozilla - at the cost of not being IE-Interface-compatible
    (e.g. you can define and inject your own JavaScript-routines and define callback-events for those routines, which are
    received within the wrapping VB-App then - very tight interaction is possible for an "InApp-Integration".

    If you want access to the DOM in more detail, then you can make use of the separate VB6-WebKit.tlb, which
    describes the available WebKit-Interface - but for many scenarios (as e.g. the example below) this "full DOM-
    access per Interface-casts" is not needed - though if you need it, then bind the Typelib into your VB6-StdExe-
    project and use it there - this TypeLib will not have to be "shipped" with your Application later on.

    Below is a Screenshot, of such an Application, which incorporates the cwBrowser-Widget (from vbWidgets.dll) - here
    communicating with an App-internal WebServer, which is startable within the same process, using only a few lines of
    code, with the help of the vbRichClient5.cWebServer-class (demonstrating app-internal Ajax-RPCs using jQuery as well
    as JSON as the serialization-format, all fully debuggable - the whole roundtrip - within the same VB6-project).

    Here the download for the SimpleWebApp-Demo-project (as said, this requires the full RC5-package, including the WebKitCairo-folder and the vbWidgets.dll ... as outlined a in the Folder-structure example a few lines above)
    http://vbRichClient.com/Downloads/SimpleWebApp.zip (66KB)

    And here a ScreenShot:


    Olaf
    Last edited by Schmidt; Sep 18th, 2013 at 07:33 PM.

  9. #9
    Addicted Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Posts
    221

    Re: how to access DOM of mozilla and netscape

    why my simple page can not run ?

  10. #10
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    351

    Re: how to access DOM of mozilla and netscape

    Quote Originally Posted by Black_Storm View Post
    why my simple page can not run ?
    WebKit is a powerful kernel, but we are used to operating under the IE kernel. If there are more examples. I believe it will be more convenient.

  11. #11
    Addicted Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Posts
    221

    Re: how to access DOM of mozilla and netscape

    my index.html worked full on chrome firefox and ie browser from windows but not worked in mozvb-ocx ,whats wrong? and do u have any sample code to run my html file in embed choronium or firefox base embed browser? or have any code for webkit sample used?

    i seen webkitx but its not free end very expensiv.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width