|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
ActiveX Webbrowser control vs Javascript
I am writing an automated webbrowser using the ActiveX webbrowser object. The point is that I have a bunch of stuff in my own database which needs to get to someone else's database but they won't allow me to access the DB in any other way than their webpage. The problem I am encountering is that at one point they pop a javascript alert via an onLoad function no matter what. What I would like to be able to do is have my automated browser click "OK" on any popped javascript alerts, and also be able to choose "OK" or "Cancel" on any javascript asserts but I haven't been able to find any books or tutorials on webbrowser control and javascript. Can anyone point me in the right direction?
(Pseudocode example of what I would like to insert into my VB) If javascript popup exists equals true then if javascript popup.button.value equals "OK" then javascript.popup.button.Click end if end if Thanks in advance everybody! - Tn |
|
#2
|
||||
|
||||
|
I may be way off-base here, but when connecting to someones webpage using the control, don't you feed their content into a variable first? If so, you should be able to strip out the content in the body tag yourself.
|
|
#3
|
|||
|
|||
|
Quote:
Indeed you do. In my case the code looks like: Dim objDocument as htmldocument Me.acxWebBrowser.Navigate "The string URL of the desired page" set objdocument = me.acxwebbrowser.document From there I can infact get a handle onto all of the outerhtml text (ie the whole html document) and then parse through it and find script tags and the text of the functions within. There is even an HTMLScriptElement held within the Document object which will do most of this for you. That being said, I can assure you that I have done all of that and have been fiddling with the methods provided in said objects for quite some time. I still have not been able to successfully create a script object (or any other object for that matter) that can access a popup alert window that was fired from a javascript function. Honestly I can't even get my automated browser to detect when an alert box has appeared. Someone from outside the forum has suggested I try an HTMLwindow2 object as well but I have not been able to make anything work yet. Hope that helps someone as I need some help myself! Thanks! -Tn |
|
#4
|
|||
|
|||
|
No other thoughts? I have yet to find an answer for this anywhere on the net. There muct be one though as IE is able to pass javascript scripts to a scripting engine and have them meddle with the DOM. Anyone?
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > ActiveX Webbrowser control vs Javascript |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|