in reply to printing valur of HASH reference
Try using Data::Dumper to see what the hash contains:
use Data::Dumper; ... print Dumper $tmp;
Then, when you know its keys, you can say something like
my $value = $tmp->{key};
Update: err wait, I overlooked that it's a Win32::IEAutomation::Element object... That means, the proper way would be to check the docs or the source for what methods that type of object provides, and then call the respective method which would give you the desired value.
Update2: actually, AFAICT, there is no ready made method for returning the selected item (only to set it), but the following might work (from a quick inspection of the source — I don't have Windows here to try):
sub getSelectedItem { my $elem = shift; my $options = $elem->{element}->options; for (my $n = 0; $n < $options->length; $n++) { if ($options->item($n)->selected) { return $options->item($n)->innerText; } } return undef; } my $selected_value = getSelectedItem($tmp);
(with multiple selections, this would return the first selected item, but you could of course easily modify it to return all selected items as an array or list)
|
|---|