473,387 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

AxWebBrowser and its api

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?
Nov 16 '05 #1
5 2189
Maybe the document has not finished loading, in that case doc_tmp will
be null. Make sure that you are calling this code only after the
document has completely loaded i.e. in the DocumentComplete event handler.

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

harry kitaun wrote:
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?

Nov 16 '05 #2
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ó:
Maybe the document has not finished loading, in that case doc_tmp will
be null. Make sure that you are calling this code only after the
document has completely loaded i.e. in the DocumentComplete event handler.

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

Nov 16 '05 #3
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"harry kitaun" <l@l.com> wrote in message
news:O%****************@TK2MSFTNGP10.phx.gbl...
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ó:
Maybe the document has not finished loading, in that case doc_tmp will be
null. Make sure that you are calling this code only after the document
has completely loaded i.e. in the DocumentComplete event handler.

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

Nov 16 '05 #4
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
Nov 16 '05 #5
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.innerT ext" 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" wrote:
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

Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Martin Ho | last post by:
Hey Everyone, I really hope there is someone who can figure out this problem. Honestly, I spent 3 days now trying to find the solution, but nothing works. I'll try to explain the problem...
0
by: Matthias Kwiedor | last post by:
I have a aplication which hosts an axWebbrowser. This activex component needs about 10 to 15 mb of memory. Because i have a option to move the aplication to tray icon and do some timer work i...
3
by: Clint MacDonald | last post by:
I have used the AxWebBrowser in a Visual Basic Project... I found that both Framework 1.0 and 1.1 had to be installed for it to work properly. I now have found that in Studio 2003, that the...
4
by: Martin Ho | last post by:
Hey Everyone, I really hope there is someone who can figure out this problem. Honestly, I spent 3 days now trying to find the solution, but nothing works. I'll try to explain the problem...
6
by: Dave Booker | last post by:
It appears that I cannot correctly install the AxWebBrowser in VS2005. I can instantiate an "AxWebBrowser browser" and refer to its members, properties, and methods. I'm having trouble with the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.