08-22-2012 11:51 PM
In a project, I must visit elements value from HTML page, read or write. but there is a message 'error -2147467262 occurred at property node (arg1) in DocumentObjectMode.vi'. take the attached file for example, when I read the length of IHTMLFramesCollection2, the error shows. How it could be?
08-23-2012 08:18 AM
@adfsafsdfsad wrote:
In a project, I must visit elements value from HTML page, read or write. but there is a message 'error -2147467262 occurred at property node (arg1) in DocumentObjectMode.vi'. take the attached file for example, when I read the length of IHTMLFramesCollection2, the error shows. How it could be?
Why are you using LabVIEW for what is essentially a website project? Microsoft's Visual Studio Express Basic would be a better tool for your needs.
08-23-2012 04:37 PM
adfsafsdfsad,
In order to better assist you, could you give me a little more information on what it is you are trying to do with this FrameTest VI? Also, are you aware if this sequence you are programming with LabVIEW works in another programming language?
Thanks,
08-23-2012 08:33 PM
Hi, NYC,
The main part of this project is programming in LabView, so I don't want to change to another programming tool if LabView could implement it. it would save a lot of time.
08-23-2012 08:44 PM
adfsafsdfsad,
In order to better assist you, could you give me a little more information on what it is you are trying to do with this FrameTest VI? Also, are you aware if this sequence you are programming with LabVIEW works in another programming language?
Thanks,
Hi, Jason M.
The FrameTestVI is just for checking if the HTML Frames Collection works, My purpose is to find a solution to visit the elements in a frame with LabView.
08-24-2012 04:34 PM
adfsafsdfsad,
Since the error is being thrown after the IHTMLDocument2 property node executes, it seems that the variant data coming out of the Document selection of the IWebBrowser property node is not information you are looking for. It seems like this is the wrong reference for the IHTMLDocument2 property node. I suggest trying to determine what the appropriate reference is for that ActiveX node is and ensuring you can provide it from inside the while loop.
Best,
08-25-2012 08:41 PM
There must be something wrong, but the IHTMLDocument2 reference is correct, just some elements in IHTMLDocument2 property node didn't work properly, like the reference frames collection 2, there are two frames in the HTML page, but why the error occurs when I try to read the length of this collecion?
Thanks for your kindly help, Do you have any other useful suggestions?
08-27-2012 01:15 PM
Try running your code in the User Interface execution subsystem (VI Properties - Execution). That eliminates the error for me (Win XP, LabVIEW 2011).
I'm not certain this is uniquely LabVIEW behavior. Try running a Google search for "ihtmldocument2 frames property invalidcastexception" and you'll see that people using other languages appear to be having the same problem. Several of the threads in those results say they were able to solve it by forcing everything to run in one thread, which is essentially what you're doing by changing to the user interface execution system.
One style note: you should close ALL ActiveX references that you open (the WebBrowser, Document, and IHTMLFramesCollection objects), in the opposite order in which you open them. Also, I find it cleaner to use constants instead of controls for the ActiveX types (such as the type input to Variant to Data).