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

The following statement works as expected when run through the Firefox Selenium IDE 2.5.0:

Commmand: click Target: //td[contains(text(), 'Configuration')]
When I try and run this using perl's Selenium-Remote-Driver, it fails. My perl command:
my $configTab=$selConn->find_element("//td[text()='Configuration']")-> +click;
Error: An element could not be located on the page using the given search parameters: //*[text()=Configuration],xpath Any ideas why this would fail? I am able to click other items, just not ones where I try and find the element by text. I have also tried:
my $configTab=$selConn->find_element("//td[contains(\@text, 'Configura +tion')]")->click;
But this also fails... Please help!!

Replies are listed 'Best First'.
Re: Unable to find_element using 'contains text' when run through Selenium-Remote-Driver
by choroba (Cardinal) on Jun 27, 2014 at 15:30 UTC
    @text and text() are two different things in XPath: the first one is an attribute, the second one a text content of an element. You probably need
    my $configTab=$selConn->find_element("//td[contains(text(),'Configurat +ion')]")->click;
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      Thanks for the reply and the clarification around 'text' and '@text'. I tried your suggestion, but unfortunately that also fails: An element could not be located on the page using the given search parameters:
      //td[contains(text(),'Configuration')],xp ath

        but unfortunately that also fails: An element could not be located on the page using the given search parameters:

        You realize this is kind of impossible, right? If it works from the GUI it should work from perl, all other things being equal