I just figured I'd post this quick work-around as I've run into this
problem a few times and the actual solution is *much* simpler than the
solution I had originally come up with...

Whenever you're using one of the assert<Text> methods (for example
assertAlert), and the test string that you want to check against
contains a colon, you might run into an error something like "cannot
find PatternMatcher.strategies.<text_before_colon>".

What's happening here is that part of your test string is being
interpretted as a pattern-matching strategy. ie, like "regexp:",
"exact:" etc.. (See htmlutils.js, line 146 which evaluates
"/^([a-zA-Z]+):(.*)/.test(pattern)", which does match your test
pattern...

The way to get around this, is to place an asterisk (*) at the start of
your test string. This makes the condition on line 146 fails, and
shouldn't affect your text result either as the check will still
function in the expected way.

Examples:
<tr>
<td>assertAlert</td>
<td>Login: is required.</td>
<td><td>
<tr>
.. will fail and give an error message "cannot find
PatternMatcher.strategies.Login"

but,
<tr>
<td>assertAlert</td>
<td>*Login: is required.</td>
<td></td>
</tr>
.. will work appropriately as long as the alert contains the string
"Login: is required." somewhere...

I hope this helps anyone who gets stuck on this..

- Peter Bernier
_______________________________________________
Selenium-users mailing list
Selenium-users@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-users

Reply via email to