perl script using Win32::IEAutomation

Hi Folks,

I am using Perl module Win32::IEAutomation for automating a web page which is implented using iceface.

I am trying to click on a image which has the following html code:

<input alt="Incidents" class="iceCmdBtn" id="_id68:_id79" name="_id68:_id79" onblur="setFocus('');" onclick="iceSubmit(form,this,event);return false;" onfocus="setFocus(this.id);" src="/ipss/images/avaya/esp/nav_inc_def.bmp" type="image">

I'm using the below code to click on the above image in my script:

$ie->getImage('alt:',"Incidents")->Click;

But I get the below error when I run my script:
Can't call method "Click" on an undefined value at ieauto.pl line 23.

I tried other attributes of getImage like class, id, imgurl ..., but still I am unble to redirect my page to the desired link.

My script works fine with other web pages, but with Iceface I think there is a problem recognizing the objects.

Please help me in this as this is blocking my work.

Please treat it as important.

Thanks in advance

Guru Charan

Try replacing this

$ie->getImage('alt:',"Incidents")->Click;

with this

$ie->getImage('linktext:',"Incidents")->Click;

This will work if the alt attribute of that image is Incidents

Its still the same problem.

I tried the command
$ie->getImage('linktext:',"Incidents")->Click;

No luck

If I use class to get the Image and there are more than one objects of the same class. How do I differentiate them and click on the object I desire.
ex:
$ie->getImage('class:',"IceGphImg")->Click;
But my page contains other images of same class.
can I do something like this:
$ie->getImage('class:',"IceGphImg")->getImage('alt:',"Incidents")->Click;

Thanks for the reply

$ie->getImage('class:',"IceGphImg")->getImage('alt:',"Incidents")->Click; would produce error

One way of debugging I can think is (need not be the optimal way): get a list of all images on the form using getAllImages() function. In this list, check the attributes of the image on which you wish to click. If you find any unique attribute, use it as argument to getImage() function.

yogesh,

thanks for your responses.

I am trying getAllImages on my web page and reading them to an array,but when I print the array element, I get the o/p as Win32::IEAutomation::Element=Hash<0x123>
How can I recognize the image with above value. How do I get the required attribute.

The problem with my web page is that all the attributes ie alt,class,id,name etc are dynamic and keep changing, so I am unable to click on them.

Is there a way I can click on these attriburtes.

Thanks,
Guru

Use the Data:: Dumper module to print that array. For example, convert this:

print @all_images_array;

to this:

use Data::Dumper;
print Dumper (@all_images_array);

This will list all the contents of array. Then you may be able to see all the attributes.