Perl-Selenium also provides the standard methods of Test::More such as ok(), like(), is(), etc , also as object methods, e.g. $sel->like().
($sel is the selenium perl object)
Should these object methods be used at all? Which one is preferred?
I am puzzled because like() and $sel->like seem to behave differently in places.
Here I assume text is indeed found on the page.
like( $found, qr /$text/, "found '$text' on page" ) ; # WORKS FINE
# DOES NOT WORK, ERROR: "doesn't look much like a regex to me."
$sel->like( $found, qr/$text/ , "found '$text' on page")
So it seems the pure like() method is preferable to $sel->like()?
It looks like Test::WWW::Selenium does not itself provide
likemethod, but rather many methods liketitle_likeortext_like.That gives us either
or
Edit: There is
likemethod available in Test::WWW::Selenium, but when dumped, it looks like this:it means that by calling as
$sel->like(...)you are adding one extra parameter ($sel) to the method call. The method is remnant ofTest::Builderinheritance and it likely not supposed to be used directly.