Skip to content

Instantly share code, notes, and snippets.

@omega
Created October 7, 2015 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omega/73afe7b09b140bee3dd4 to your computer and use it in GitHub Desktop.
Save omega/73afe7b09b140bee3dd4 to your computer and use it in GitHub Desktop.
attr_is example
sub _attr {
return 'No such element' unless my $e = shift->tx->res->dom->at(shift);
return $e->attr(shift);
}
sub attr_is {
my ($self, $selector, $attr, $value, $desc) = @_;
$desc ||= encode 'UTF-8', qq{exact match for attr "$attr" on selector "$selector"};
return $self->_test('is', $self->_attr($selector, $attr), $value, $desc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment