A few months ago, Selenified was released as open source software. We had previously made the jar available for anyone to use, but the main goal was to release the project as open source and let the testing community understand what it was they were using.

I’ve gotten a lot of great feedback since then, and looked at incorporating much of it. I, of course, fixed bugs and added some additional functionality, but the big thing I wanted to tackle was making Selenified object oriented (OO).

One of the great things about WebDriver over Remote Control (RC), was its ability to manipulate elements directly, and this was definitely noticed when working on the 2.0 release. Unfortunately, there was a lot to re-work to get to this point, and we decided to get Selenified out the door instead of trying to perfect it before our release. We didn’t want to fall into the ‘doom trap.’ We were trying to follow a good agile software development process: identify your MVP, release it, and then iterate on it.

Well, the time to release our MVP is finally here: Selenified 3.0 offers the ability to perform all your actions in an object oriented fashion.

Writing Your Test Cases

Previously, there was a bit more setup involved in starting your test cases. By making Selenified object oriented, we’ve made this setup a lot simpler. The basic setup is there is now one app object, where all interactions are performed. Pages should be built based on this object (if using the page object model (POM)) so that several pages make up an app. Within each page, multiple elements should be created. In this way, we can act on our app, page, or element directly. If you choose not to use the POM, then simply build your elements directly out of your app.

Basic Browser Testing

If you plan on running a browser-based test, the first thing you should do is retrieve your app class.

    App app = this.apps.get();

This object will give you access to perform any required actions on the application, such as accepting an alert, asserting an alert is present, or reloading the page.


If you want to interact with particular elements on a page, you can create them from this app object.

    Element element = app.newElement(Locator.XPATH, "//form/input");

Similar to the app object, any actions you want to perform on the element can be done on this object, such as clicking on it, entering text, or selecting a value that is available.

    element.type("hello world");

Sub-functionality exists for both pages and elements, to make writing tests simpler. Objects exist for getting, checking, and waiting for things on the application in general. Additionally, objects exist for getting, checking, and waiting for each element.


There are also custom assertions associated with both the page and element objects. These asserts are custom to the framework, and in addition to providing easy object oriented capabilities, they take screenshots with each verification to provide additional traceability, and assist in troubleshooting and debugging failing tests.


Similar to prior Selenified releases, errors are internally monitored – if you try to click on an element, and it doesn’t exist, the test won’t stop, but an error will be recorded. In order verify that each test passes without any recorded errors, the last step of each test compares the value within errors to the number 0. This action will throw an error if any issues occurred during the test. This allows prior errors to be handled gracefully, but still causes tests to ultimately fail, if errors are encountered. This last line should read as follow:


Using an IDE such as Eclipse will help you auto-complete desired commands, and the JavaDocs provided will outline each piece of functionality. If using Maven Central, the JavaDocs and source will automatically get attached in your IDE, which will further assist with development.

Using POM For Browser Testing

Selenified supports allowing tests to be written following the Page Object Model (POM). Each page or module you want to use in this model, simply needs a constructor taking in the `app` object, where the desired page elements are defined. Then any workflows on the page can be easily written utilizing those elements.

public final class MainPage {

    // our page elements
    private Element click;
    private Element alert;
    private Element carList;
    public Element checkbox;

    public MainPage(App app) {
        click = app.newElement(Locator.CLASSNAME, "click");
        alert = app.newElement(Locator.CSS, "input#alert_button");
        carList = app.newElement(Locator.ID, "car_list");
        checkbox = app.newElement(Locator.XPATH, "//form/input[@type='checkbox']");

    public void selectCar(String car) {

    public void assertCar(String car) {

    public void generateAlert() {

In order to use these models, your tests only need to instantiate these pages before running. This is done most simply in a @BeforeMethod call.

    ThreadLocal<MainPage> main = new ThreadLocal<>();

    @BeforeMethod(alwaysRun = true)
    public void setupApp() {
        main.set(new MainPage(this.apps.get()));

    @Test(groups = { "sample", "pom" }, description = "A sample test to perform searches")
    public void sampleTestWDataProvider() {
        // our test actions - use our threadsafe main object
        // close out the test

What’s Next

This 3.0 release was just as major as the 2.0 release, and there is a LOT in it. Stay tuned for future posts, diving more into POM, testing services, and more.

If you find an issue, be sure to let us know. We’re actively working on development, and are willing and able to fix it. You can also fork the repository, make some fixes or changes yourself, and submit a pull request. We are happy to have an active and interested community!

One thought to “Selenified 3.0: Now Object Oriented”

Leave a comment

Your email address will not be published. Required fields are marked *