user-icon Stefan Ludwig
12. October 2014
timer-icon 2 min

Migrating from Selenium to testIT WebTester

Migrating to testIT WebTester from a project, where Selenium page objects are already in use, is very easy! You can migrate in 8 simple steps.

Note: With selenium page objects I mean page objects as described on these pages:

You can download a demo project from our FTP server. This project contains a sample application with Selenium and WebTester tests, to illustrate the changes when migrating:

Changes to your page objects:

  1. Change the parent class of your page objects to PageObject.
  2. Change every WebElement of your page objects to a PageObject or one of the “out of the box” subclasses (like Button, Textfield, Table etc.).
  3. Replace the @FindBy annotation with @IdentifyUsing:
    1. Change the ‘how’ attribute to ‘method’ and choose the appropriate method of identification (ID, CSS, XPATH etc.).
    2. Change the ‘using’ attribute to ‘value’.
  4. Move any ‘am I on the right page’ validation code to a method and annotate it with @AfterInitialization.
  5. Remove all WebDriver fields and page object constructors.
  6. change all following page initialization to use the PageObject method ‘createPageObject(Class pageClass)‘.

Changes to your tests:

  1. Replace your initialization of a WebDriver with a call to the BrowserFactory class, giving you a Browser object.
  2. Change the initialization of page objects to use the PageObjectFactory method ‘createPageObject(Class pageClass, Browser browser)‘.

Since you were already using page objects in your tests, everything else shouldn’t need to changed.

You can get the WebTester documentation and latest developments from the testIT documentation space:


Comment article