udday.shank has asked for the wisdom of the Perl Monks concerning the following question:

My task is to login to www.gmail.com and then select the checkbox corresponding to first mail and delete. However, I am unable to select the checkbox. Here is my snippet:

use Win32::IEAutomation; use Data:Dumper; $\="\n"; $,=" "; open FH, ">D:/material/Perl_ppts/test.txt" or die $!; $ie=Win32::IEAutomation->new(visible=>1, maximize=>1); $url='https://www.google.com/accounts/ServiceLogin? service=mail&passive=true&rm=false&continue=http://mail .google.com/mail/%3Fui%3Dhtml%26zy% 3Dl&bsv=1eic6yu9oa4y3&scc=1&ltmpl=default&ltmplcache=2 '; $ie->gotoURL($url); $ie->getTextBox('id:', 'Email')->SetValue ('<userid>'); $ie->getTextBox('id:', 'Passwd')->SetValue ('<password>'); #print $ie->PageText(); $ie->getButton('id:', 'signIn')->Click; print Dumper($ie->URL()); $ie->getCheckbox('id:',':nu')->Select; #Failed #then i tried this-> $ie->getCheckbox('index:', 1)->Select; #FAILED

I get error stating: cant call select on an undefined object. Please tell how to select a particular checkbox(say 3rd or 4th)

Replies are listed 'Best First'.
Re: Win32::IEAutomation: Unable to select checkbox
by Anonymous Monk on Jan 06, 2011 at 08:43 UTC
Re: Win32::IEAutomation: Unable to select checkbox
by Anonymous Monk on Jan 06, 2011 at 07:14 UTC
    I get error stating: cant call select on an undefined object. Please tell how to select a particular checkbox(say 3rd or 4th)

    Just exactly like you are attempting. Since its failing, you have to figure out why. Simples approach is to dump the html when it fails to find the checkbox.

    My guess, the html must not be what you are expecting (the id is not :nu, its not the first....)

      In order to dump the output, the OP will need to fix use Data:umper - that code wouldn't even run....
        thats a typo, it is correct at my end though and it certainly isnt the problem. Please see if you can help crack the actual problem as described