Hello,
I am trying to automate an interface to this website:
http://www.class.noaa.gov/nsaa/products/upload which conforms to the
DOM.

I have managed to login and to load all document elements into an
object collection, but am having difficulties interacting with these
elements beyond the .Click() method.


1) Presuming I have loaded all elements on the page into oCollection. I
then try to search through the elements Name property to match
"uploaded_file" which is the input_file object.

iCount = 0
Do
Set oElement = oCollection(iCount)
iCount = iCount + 1
Loop Until oElement.Name = "uploaded_file"

The above code does not work. Is it because some elements on the page
do not have a Name property? How to Fix?

2) If I manage to find the correct object will the following code be
enough to set the file to upload and move on to the next page?

oElement.Value = filename
oElement.Click()

3) Is there a more simple way to set/get element name/property pairs
that having to parse the entire page? I know the element's name is
"upload_file".

4) There are two submit button on the page, but only one is named. How
do I find and activate the unnamed one?

5) Is it better to use the Microsoft.XMLHTTP object for my purposes?

6) Can anyone point me to an online reference relevant to what I am
trying to do that is more illustrative than the MSDN pages? I do not
know exactly what the topic should be. Is it DOM, ASP or something
else? I need a gentle primer.

Thanks

Re: Automate Interaction With Webpage by Paul

Paul
Fri Dec 15 12:36:16 CST 2006

Rather than looking at every element in document.all, why not just look
through the collection of the element of the type you are interested in:
oIEDoc.All.Tags("INPUT"), for example, returns a collection of all <input
...> elements.

One problem you may find is that a script may be attached to the submit or
click event of various elements, making it difficult to know what is
happening, as in this form element:
<form name="search" action="search" method="get" onsubmit="return
check_df(this)">

You can get the collection of script elements, analyze them, and perhaps
change them to suit your needs with code like:
scriptelement.innerHtml = "your new script"
before clicking or submitting.

I'm not sure if this is always true, but in general I've found that I don't
have to do anything special to use a modified element if I can just use
element.innerHtml = "new/modified stuff". For the effect I want, some types
of elements require me to use element.outerHtml = "new/modified stuff".
After modifying the outerhtml of an element, I find that I must go through
the process of getting the oIE.Document and find the element again that I
want to click/submit or whatever. I sometimes use element.outerHtml = "" to
remove certain elements to simplify the web page before processing it.

-Paul Randall

"Brendan" <brendandetracey@yahoo.com> wrote in message
news:1166023284.738553.222580@73g2000cwn.googlegroups.com...
> Hello,
> I am trying to automate an interface to this website:
> http://www.class.noaa.gov/nsaa/products/upload which conforms to the
> DOM.
>
> I have managed to login and to load all document elements into an
> object collection, but am having difficulties interacting with these
> elements beyond the .Click() method.
>
>
> 1) Presuming I have loaded all elements on the page into oCollection. I
> then try to search through the elements Name property to match
> "uploaded_file" which is the input_file object.
>
> iCount = 0
> Do
> Set oElement = oCollection(iCount)
> iCount = iCount + 1
> Loop Until oElement.Name = "uploaded_file"
>
> The above code does not work. Is it because some elements on the page
> do not have a Name property? How to Fix?
>
> 2) If I manage to find the correct object will the following code be
> enough to set the file to upload and move on to the next page?
>
> oElement.Value = filename
> oElement.Click()
>
> 3) Is there a more simple way to set/get element name/property pairs
> that having to parse the entire page? I know the element's name is
> "upload_file".
>
> 4) There are two submit button on the page, but only one is named. How
> do I find and activate the unnamed one?
>
> 5) Is it better to use the Microsoft.XMLHTTP object for my purposes?
>
> 6) Can anyone point me to an online reference relevant to what I am
> trying to do that is more illustrative than the MSDN pages? I do not
> know exactly what the topic should be. Is it DOM, ASP or something
> else? I need a gentle primer.
>
> Thanks
>