gempesaw/Selenium-Remote-Driver — pull request #58 by gempesaw (2014-10-12 17:06:59+00:00)
Title: Add ->get_user_agent shortcut sub to enable easy access to user agent string

Sometimes it's useful to skip tests in a particular browser. For example, right now Phantom JS appears to have trouble with alert boxes.

This is not very hard now, but's also not very intuitive, either. Here's what it looks like now to skip a test under PhantomJS:

skip "Alert boxes not supported well in PhantomJS", 2
if ($s->execute_script(q{return navigator.userAgent;}) =~ m/PhantomJS/;

A shortcut would be welcome. Like:

# Perhaps because it's popular, it deserves it's own method?
if $s->is_phantomjs;

# Or, more generally
if $s->user_agent_like(qr/PhantomJS/);

What do you think?