LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview calling webpage and executing search

Looking for a means to launch a webpage and fill in a box and then hit a search button to return a value. Found this VI and attempted to make it work with the digikey website but it has issues.  Anybody know whats wrong here?

0 Kudos
Message 1 of 11
(3,268 Views)

Please include a Snippet of your code, or attach a version of your VI in LV 2016 or older, so I can take a look.

 

I used to do some webpage automation with LabVIEW, but it's definitely not the easiest way to do it. I've since used Python and sometimes VBA to automate and found it much easier to do.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 11
(3,245 Views)
0 Kudos
Message 3 of 11
(3,230 Views)

That's still LabVIEW 2017

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 4 of 11
(3,226 Views)
0 Kudos
Message 5 of 11
(3,217 Views)

Hi id,

 

Can you please provide us with the subVIs being called by your code as well? The VI you uploaded requires "IE Set Element Value.vi" and "IE Button Click.vi" to run. Based on the leftover paths, these look like VIs that you downloaded as drivers for this application. It's trying to source them from my downloads folder so it's likely you can find them in the downloads folder on your machine.

 

For what it's worth, the code you have provided looks sound. However, the subVIs that are missing could be the source of your issue. It will be hard for us to help without seeing those VIs.

 

Best,

 

Duncan Waldrop

Applications Engineer

National Instruments

0 Kudos
Message 6 of 11
(3,190 Views)

Duncan, his zip file in his last reply includes those subVIs.

 

I tinkered with this a bunch last night and couldn't get the node to return the proper reference to the digikey search bar. Maybe an Apps engineer can do it better. I can access the "header" element, but anything lower than that didn't work.

 

Is there a way to get an element using its class name instead of tag?

 

Good luck!

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 7 of 11
(3,183 Views)

Oops... I was using the original linked VI instead of the .zip. Thanks for the catch!

 

I'll continue looking into this, but it's going to come down to a question of how to use Microsoft's MSHTML interface properly, which is not particularly well documented. If this is a pressing issue, I would recommend reaching out to Microsoft's support team to see if they can offer any insight into how their API is treating these function calls. For instance, it's hard to tell what each HTML element defined on Digikey's webpage is being bucketed as under the Microsoft API.

 

I can confirm that the reason this code is not working in its current state is that the IHTMLElementCollection property node is returning a collection of elements, since "keywords" is used as a name multiple times in the document. This causes the typecast and property node call to an IHTLMElement fails because the reference is not of this type. I'm working on getting a reference to the underlying search bar text element now.

 

James, I have found a couple of links now that claim searching by class name is not supported by Microsoft's API. I find this a little hard to believe so I'll keep looking. I'll let you know if I find anything.

 

-Duncan

0 Kudos
Message 8 of 11
(3,172 Views)

Are we trying to search Google?  Because if so you can just format the URL to have the search request in it.  I've even used this in the past combined with the Feeling Lucky input so that Google takes me to the first hit page.

0 Kudos
Message 9 of 11
(3,167 Views)

@Hooovahh wrote:

Are we trying to search Google?  Because if so you can just format the URL to have the search request in it.  I've even used this in the past combined with the Feeling Lucky input so that Google takes me to the first hit page.


I think he's trying to search digikey

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 10 of 11
(3,164 Views)