Saturday, May 24, 2014

add support for new browsers

There is an enum based Browser support in Selenium Capsules, the code is here, Browser


The Firefox is,

It doesn't contain all of the browsers on the market, how to extend it to support new browsers?
It is easy, just add another class to implement Browser interface then you can use this new Browser type to support page framework,

The difference between Firefox and FirefoxOnWindows is FirefoxOnWindows also implements Browser interface while Firefox doesn't.

So Firefox itself can't be used as a parameter the constructor of the AbstractPage, what's the reason for this? this reason is simple, since it is used to be part of the enum constants Browsers, so Browsers is preferred class to use in the codebase, then it can used as value in Spring context file and use Java property to choose the browser for the tests.

browser=FIREFOX
or
browser=CHROME

No comments:

Post a Comment