LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Determine if web browser has finished loading page

Hello everyone!

 

I've heard that there are no stupid questions, but this one seems a little silly.

I'm working on a small "hobby" project to automate a tedious and time consuming process:

filling in a form in a web browser with different information 50 times.

Now I have my information in a database, and have LabVIEW "typing" in the information on the webpage.

This will typically look like: "TAB - TAB - DOWN - DOWN - SPACE - *Text* - TAB - ENTER".

 

This is working very well, and I can simply start the script, and take a break.

 

The problem starts if the web page for some reason is responding slowly. At certain points in the process there is javascript loading information, and I've added pauses accordingly.

 

One solution would simply be to add a very long pause, so that it would load 99.99% of the time. This is not a very good solution, and I was hoping that someone here would have a creative and elegant way to do this.

 

I can start the discussion myself with two thoughts, one of which works.

 

Using USER32.dll I tried reading the caret position (getcaretpos), to be able to determine if the caret was in a "writable" position, as I assumed it returned 0 or error while the site was loading. I was not able to make getcaretpos work as intended, even though getcursorpos (same call signature) worked fine.

 

Second attempt was using the clipboard. While loading the page LabVIEW is typing a letter, highlight it, and cut it. Then I check if the clipboard contains the letter. While loading, the clipboard is empty, and when loaded, the letter will appear. This seems to work, but is not a nice solution.

 

So this is not a very serious or important question, but a chance for all the creative minds out there to show off.

 

Just to make it clear, I'm not talking about loading the web page in LabVIEW. I have the browser open, and simply click it to give focus when starting the LabVIEW script. The web page in question requires log in, javascript, etc., so I'm not sure if loading the page in LabVIEW would work..

 

Looking forward to hear from you.

0 Kudos
Message 1 of 3
(1,107 Views)

I'd try "web scraping" to figure out what is on the web page.  Creative use of this technique will probably get you where you want to go.  Caveat: It's against most web sites' TOS to do this.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 3
(1,080 Views)

There is an onLoad event in the browser that you could attach a function to that you could have send some information to your labview application, such as perhaps a webservice. There are tools such as greasemonkey for attaching scripts to pages you load in the browser. And Labview can act as a web service. Alternatively, maybe you can have Javascript write a file that Labview monitors. This all assumes the window.onLoad event is sufficient for what you want.

0 Kudos
Message 3 of 3
(1,078 Views)