Chaoui05 has asked for the wisdom of the Perl Monks concerning the following question:

Hi everymonks ! i have this following issue. I would like to add one test in my function using Selenium module, to check my page 'logout' . I used this native method from this module. But i don't understand why it doesn't work . I have an error in my CLI .

$elem = $driver->find_element_by_link('/logout','href'); $driver->mouse_move_to_location(element => $elem); # xoffset => x, + yoffset => y $driver->click_ok('LEFT');

My web code related found with the chrome inspector is : a href="/logout" class="faa-parent animated-hover">

And my error message in CLI is : An element could not be located on the page using the given search parameters: /logout,link text at C:/Strawberry/Finders.pm line 18.

Many Thanks guys !!

Replies are listed 'Best First'.
Re: One method in Selenium
by choroba (Cardinal) on Apr 20, 2016 at 15:40 UTC
    The documentation of the method is not detailed enough, but looking at the tests, it seems that find_element_by_link takes the link text as the parameter, not the value and name of an attribute. I'd try XPath instead:
    my $elem = $driver->find_element('//a[@href="/logout"]');

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
      Many thanks Choroba . I think you are the best in test with Perl .( I think i saw you in stackover flow too?!) So not impossible i will ask you again some questions, here, if you are down