Hi,

I am using Test::More along with WWW::Selenium to automate some router GUI browsing. One thing I am trying to do is use Test::More's "like" function to check that certain contents on the web page match a regular expression.

For example I want run the contents of a web element where the router's wireless SSID is shown against a regex and then print the match so the code would look something like:

like($sel->get_value("name=wlSsid_wl0v0"), qr/\S{1,}/, "1000.0362 SSID was displayed on the wireless settings page \($&\)");

I would like to be able to use the various local special variables in perl such as $& and $1,$2 etc so that I can print what the script finds against the regex pattern match, but they dont seem to work. I'm guessing this a localisation issue? Any help would be much appreciated and I can provide more info if needed.


In reply to Test::More not working with Perl local special variables by Doozer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.