Please run Selenium with Firefox

firefoxwebdev

I couldn’t figure out why our QA insists using Firefox for the selenium test, until I was bitten by two bugs which were only reproduced in firefox, but not in chrome.

The first one was in the jQuery selector. We wanted to select an input field with name attribute like foo[bar][sapm], but I missed the ]' in the jQuery selector, see the diff below:

- $("input[name='foo[bar][" + el + "]").attr("checked", true)
+ $("input[name='foo[bar][" + el + "]']").attr("checked", true)

The chrome had no problem with that, it did exactly what I expected. But firefox just shouted out loudly by throwing javascript exceptions.

The second bug was in the CSS. My intention was to use the webfont for the h1 element, and fallback to whatever font-family the user agent preferred:

h1 {
  font-family: "LeagueGothicRegular", inherit;
}

Again, the chrome just picked the webfont and rendered the content, while firefox used the inherited font family.

Conclusion

Firefox is very strict with the standard, please use firefox for your selenium testing to do things right.