Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Selenium IDE command evaluating a regex against a string in the DOM, something like this -

Command   waitForEval
Target    /http:\/\/\/path\/image-/.test(window[window.varA+'-'+window.varB]);
Value     true

After editing, all slashes appear double escaped, like \\/

The command evaluates successfully in the Firefox IDE and Chrome WebDriver, but the regex appears to have invalid syntax when run in IE8 through WebDriver (via the IDE and IEDriverServer).

Is there a better way to construct a command like this, that might avoid the regex escaping and syntax issues?

Could this be a bug between the IDE, WebDriver and IEDriverServer?

share|improve this question
Do you need the full DOM path or is it possible to locate the item you're searching for by attribute? That might allow you to avoid the regex altogether: I've found regex engines can be quite finicky. Another thing to consider is that IE8 may simply interpret the double backslash differently than other browsers - it wouldn't be the first time IE8 has done something nothing else does. – Kate Paulk May 29 '14 at 11:20
Thanks Kate. It's not an issue with locating an element (it's actually just a JS variable), it's the regex to test the value of it. It works when run unescaped directly in the IE console, but not after being stored and executed by the Selenium command. – Nils May 30 '14 at 7:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.