Home All Groups Group Topic Archive Search About

Read Javascript Messagebox content from webclient

Author
2 Sep 2006 4:36 PM
Michael Duclon
Does anyone know how I might use the webclient class to navigate to a web
page in a vb.net app, and then if a JavaScript popup appears from the web
page I go to, read the message in it or content of it, then close it so I
can continue on.
I don't know how to reference the popup box or send a command to click the
ok button to close it.
Mike Duclon

Author
2 Sep 2006 5:15 PM
Martin Honnen
Michael Duclon wrote:

> Does anyone know how I might use the webclient class to navigate to a web
> page in a vb.net app, and then if a JavaScript popup appears from the web
> page I go to, read the message in it or content of it, then close it so I
> can continue on.
> I don't know how to reference the popup box or send a command to click the
> ok button to close it.

WebClient does a HTTP request and fetches the HTTP response for you but
it does not know anything about HTML documents or HTML documents with
JavaScript.
If you want to render a HTML document like a browser does then in .NET
2.0 you have the WebBrowser control
<http://msdn2.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx>
I am not sure however there is a way then from .NET to close JavaScript
alert dialogs.


--

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/
Author
2 Sep 2006 7:44 PM
Michael Duclon
thanks Martin, I've decided to try and use the WebBrowser control.
I'm looking at it to see if I can figure out how to close the javascript
window using that route. It seems like I should be able to access it from
the document object.
If anyone has any thoughts on that or has tried this please let me know, and
if I find the answer I will post back.

Michael Duclon

Show quoteHide quote
"Martin Honnen" <mahotr***@yahoo.de> wrote in message
news:%23iMY3NrzGHA.4932@TK2MSFTNGP02.phx.gbl...
>
>
> Michael Duclon wrote:
>
>> Does anyone know how I might use the webclient class to navigate to a web
>> page in a vb.net app, and then if a JavaScript popup appears from the web
>> page I go to, read the message in it or content of it, then close it so I
>> can continue on.
>> I don't know how to reference the popup box or send a command to click
>> the ok button to close it.
>
> WebClient does a HTTP request and fetches the HTTP response for you but it
> does not know anything about HTML documents or HTML documents with
> JavaScript.
> If you want to render a HTML document like a browser does then in .NET 2.0
> you have the WebBrowser control
> <http://msdn2.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx>
> I am not sure however there is a way then from .NET to close JavaScript
> alert dialogs.
>
>
> --
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
Author
2 Sep 2006 6:42 PM
John Timney (MVP)
When you request the page using the webclient classes, the remote server
sends the page back as a response.  It does not undertsand html or
javascript and will not actually run the page for you as a browser would, in
short you have the resulting HTML as if you did a view source from within a
browser..

Regards

John Timney (MVP)


"Michael Duclon" <mduc***@verizon.net> wrote in message
news:aqiKg.672$%75.192@trnddc05...
Show quoteHide quote
> Does anyone know how I might use the webclient class to navigate to a web
> page in a vb.net app, and then if a JavaScript popup appears from the web
> page I go to, read the message in it or content of it, then close it so I
> can continue on.
> I don't know how to reference the popup box or send a command to click the
> ok button to close it.
> Mike Duclon
>
Author
4 Sep 2006 6:28 PM
Mike McIntyre
Here is a link to an article that explain a bit about blocking popups by
extending the .NET 2.0 WebBrowser control:

http://www.codeproject.com/csharp/ExtendedWebBrowser.asp

--
Mike

Mike McIntyre [MVP]
http://www.getdotnetcode.com


"Michael Duclon" <mduc***@verizon.net> wrote in message
news:aqiKg.672$%75.192@trnddc05...
Show quoteHide quote
> Does anyone know how I might use the webclient class to navigate to a web
> page in a vb.net app, and then if a JavaScript popup appears from the web
> page I go to, read the message in it or content of it, then close it so I
> can continue on.
> I don't know how to reference the popup box or send a command to click the
> ok button to close it.
> Mike Duclon
>