AxWebBrowser and its api

H

harry kitaun

well, I know that playing with an axwebbrowser is almost an esoteric
exercise ;) but i can't solve this.

I'm writing an automation tool to fetch some data from pages in our
intranet (nothing more complex than navigate to the web, fill in
user&pass and retrieve the data), but the AxWebBrowser throws an
exception in the next lines:

....
IHTMLDocument2 doc_tmp=(IHTMLDocument2) this.axWebBrowser1.Document;
IHTMLFramesCollection2 frames = doc_tmp.frames;
....

but only if this lines are outside of the DocumentComplete2 event
handler. What's wrong? i've tried to access data in a single-framed page
and works correctly in an arbitrary method (not event handler). why i
cannot access the api if the web is multiframed?
 
H

harry kitaun

Hi.

i've already tried this and it continues to fail. If it helps, the
exception isn't the System.NullReferenceException one; it is thrown for
"incomptatible interface" :?

thanks anyway


Sijin Joseph escribió:
 
N

Nicholas Paldino [.NET/C# MVP]

Harry,

I am curious, if all you are doing is downloading content (and you don't
need to render it because it is automated), why not use the HttpWebRequest
class to download the content and then work with it then? It would be much
faster (you don't have to deal with rendering it).

Hope this helps.
 
H

harry kitaun

Nicholas Paldino [.NET/C# MVP] escribió:
Harry,

I am curious, if all you are doing is downloading content (and you don't
need to render it because it is automated), why not use the HttpWebRequest
class to download the content and then work with it then? It would be much
faster (you don't have to deal with rendering it).

Hope this helps.

first of all because of the autentication method. This page has several
javascript comprobations and hidden inputs before post/get the form to
the servlet, and it's easier to fill just two fields and click "login"
than figure out what headers i have to pass to the form. But the most
importante reason is because the page is fully formatted with tables,
images and so on, and is faster to get simply the table i want by mshtml
than dig in the html of an httpwebrequest looking for a tag.

thanks
 
G

Guest

Hello Harry,

Do you find the method to access the html source of the multiframed pages? I
meet the same problem.

mshtml.HTMLDocument htm = (mshtml.HTMLDocument)axWebBrowser1.Document;
While I tried to use "htm.frames(2).Document.documentElement.innerText" to
get HTML source, it said "Cannot apply indexing with [] to an expression of
type 'mshtml.FramesCollection'". Do you know how to resolve it?

Thanks,
Simon

harry kitaun said:
Nicholas Paldino [.NET/C# MVP] escribió:
Harry,

I am curious, if all you are doing is downloading content (and you don't
need to render it because it is automated), why not use the HttpWebRequest
class to download the content and then work with it then? It would be much
faster (you don't have to deal with rendering it).

Hope this helps.

first of all because of the autentication method. This page has several
javascript comprobations and hidden inputs before post/get the form to
the servlet, and it's easier to fill just two fields and click "login"
than figure out what headers i have to pass to the form. But the most
importante reason is because the page is fully formatted with tables,
images and so on, and is faster to get simply the table i want by mshtml
than dig in the html of an httpwebrequest looking for a tag.

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top