Tuesday 10 May 2011

how to access specific button using Win32:Ieautomation?

1)Copy exists _getObject function and create a new _getObject(like Sub _getObjectSpecific and add for loop for access spefific button.
2)Now create a any function for specific link/button/list...
For example:for specifc button

sub getSpecificButton{
my ($self, $how, $what,$i) = @_;
my $agent = $self->{agent};
my $buttons = $agent->Document->all->tags("input");
my $target_button = __getObject1($buttons, $how, $what,$i) if ($buttons);
my $button_object;
if ($target_button){
$button_object = Win32::IEAutomation::Element->new();
$button_object->{element} = $target_button;
$button_object->{parent} = $self;
}else{
$button_object = undef;
print "WARNING: No button is present in the document with your specified option $how $what\n" if $warn;
}
return $button_object;
}

No comments:

Post a Comment