From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling a web page from Labview

Solved!
Go to solution

Hello,

I am trying to acquire image from an Encoder's IP address, but I'm facing some problems:

1. Once the Ip address is loaded, the web page asks for authentication (user and password), so I don't know how I can send this information to IE through Labview.

2. Once one has logged in, the web page shows a window with ActiveX controls in which the image from a camera is acquired and can be zoomed in and out, or saved. I need to saved the image, so I would need to send an instruction to the page as if I had clicked in the "Save" icon. I wonder if I can send some sort of instructions telling "buttonX=ON" or using the coordinates in the window to simulate a click or sth.

I tried the "AutoIT Example.vi" and changed it to call internet explorer and then sending the URL, and I also tried the "open_browser_send_URL.vi" but as I said, I'm stuck in the authentication part.

 

I would greatly appreciate any suggestions you may have to deal with this problem.

Thanks

0 Kudos
Message 1 of 24
(7,631 Views)

I have used simulate_keybaord.vi with some success to enter data into webpage forms. As far as the button you want to press, if there's a function key that does the same thing, or <alt>+Save, or something where the keyboard can get to that button, then you can do that also.

 

 

 

Richard






0 Kudos
Message 2 of 24
(7,605 Views)

Good morning, Kalinikos


I attach some links below, guidelines that can be made. Any questions please contact us.

 

Sending an Email from a VI

http://zone.ni.com/reference/en-XX/help/371361G-01/lvhowto/send_email_from_vi/

 

Sending HTML Emails in LabVIEW

https://decibel.ni.com/content/docs/DOC-9233

 

Using LabVIEW to Send Email with Microsoft Outlook

http://zone.ni.com/devzone/cda/epd/p/id/3708


Sincerely,

Mauro Vera
Applications Engineer
National Instruments
0 Kudos
Message 3 of 24
(7,602 Views)

When you attempt to log in to the web page, does it use a form on the web page, or does it pop up a separate authentication dialog?  If it's a form within the web page, you may be able to do this using Internet Explorer and LabVIEW.  The details will depend on your web page - if it uses a form submit then it should work, if it relies on Javascript then it may be more trouble.  You'll have to look at the web page source to identify the correct form elements.  I'm attaching a VI that demonstrates how I handled this in one previous project.  The VI expects that you'll pass in a reference to a WebBrowser object.

 

To save the image, you may again be able to dig into the HTML source of the web page to find out what method of the ActiveX object is being called.  You can then obtain a reference to that ActiveX object, cast it to the appropriate type, and call that same method from your VI.  I've done this before for a web-based label-printing application, as shown in the attached image.  In this case the ActiveX component is called TidAx1 (which I found from looking at the source of the web page).  After obtaining a reference to the ActiveX component within the web page, the LabVIEW programmer has access to all its properties and methods.

 

ActiveX within web page.PNG


@Mauro Vera wrote:

I attach some links below, guidelines that can be made. Any questions please contact us.


Sometimes it's really hard to know if you NI people (so I'm assuming, from the blue username) actually read the questions before you attempt to answer them... why would you attach links about sending email when the poster asked about reading data from a web page?

 

 

Download All
0 Kudos
Message 4 of 24
(7,591 Views)

Hello nathand,

It is a form within the web page that asks for user and password. Thank you very much for your answer. l'll try it out

0 Kudos
Message 5 of 24
(7,579 Views)

The web login part is working thanks to nathand's vi. Now, to simulate the click I'm confused about using "Property Node" and "Invoke Node". How do I know how far I have to get using these elements to get to the element I want to get to. Is there a guide to do this?, to know if I need a IHTMLElement, ElementCollection or whichever function I would need to use.

 

Thank you very much for your time.

0 Kudos
Message 6 of 24
(7,550 Views)

There's a lot of documentation on the properties and methods available in Internet Explorer through MSDN.  You'll at least need to dig as far as I did in the image I posted (get a reference to the IHTMLElementCollection of all elements on the page, then identify the correct element by name).  If you need help, I'm willing to take a look, but you'll need to post the source of the relevant web page (View Source in your web browser, then copy/paste or save to a new file and upload that).

0 Kudos
Message 7 of 24
(7,544 Views)

Thanks again for your time. I took a screenshot of the icon that I have to click on and the code that the browser shows. I guess I would have to call the on_snapshot() function but I am not sure how to do that.

 

Thanks

0 Kudos
Message 8 of 24
(7,535 Views)

I don't see any reference to an ActiveX control there, just Javascript.  Why did you mention an ActiveX component in your original post?  I can't do anything with that screenshot; I'd need the entire web page source so I can see what the javascript functions are doing.  However, since the image seems to be displayed without the assistance of any ActiveX control, you should be able to set the browser to navigate directly to the image (rather than to the web page in which it is embedded), and from there I would guess you can retrieve or save the image directly in LabVIEW, unless there's some particularly good reason to go through the web page to do it.

0 Kudos
Message 9 of 24
(7,530 Views)

I thought they were ActiveX controls. Attached is the web page saved as .mht (I hope that is the full source code). Regarding what you said of taking the picture, I had thought taking it the same way I do it manually, but taking it directly from LabView totally makes sense to me. The problem is that I don't know how to do neither of those. Once again, thank you for your help and please pardon me if I'm not being perfectly clear.

0 Kudos
Message 10 of 24
(7,525 Views)