четверг, 15 января 2015 г.

Selenium tests: Page Object Generator

When you need to automate tests for web-application with a lot of pages, it is hard to describe page objects for all pages manually.
There are free, easy, fast and user friendly service for page object generation automation
http://whispering-retreat-7160.herokuapp.com/generator

This web-application can generate Selenium Page Objects from html code or by link to web-page.
Generator supports following languages: Java, C#, PHP, Ruby.

How to generate page object:
1. Copy-paste html code
2. Select language: Java, C#, PHP or Ruby

3. Write selectors you need, e.g.  //a;//input
4. Click on Generate


5. After that Page Object will be generated:
public class CustomPage {

 @FindBy(id="paramField")
 private WebElement paramField;

 @FindBy(id="code")
 private WebElement code;

 @FindBy(id="description")
 private WebElement description;

}

It is about all, you can copy the page object in your project, rename and do any changes you need.