The idea behind the Page Object pattern is that they model the _services_ offered by the page. That is, although a page might have a form with two fields --- "email" and "passwd" --- the service it offers the ability to log in to the site. The expected API for this Page Object would be something like:
public class LoginPage {
...
public HomePage loginAs(Credentials user) {
driver.findElement(By.name("email")).sendKeys(user.getEmail());
driver.findElement(By.name("passwd)).sendKeys(user.getPassword());
// somehow submit the form and wait for the home page to load
return new HomePage(driver);
}
...
}
This isn't really something that can be autogenerated. To minimize the pain of writing page objects, and to remove some of the boilerplate, I introduced the PageFactory class, which reads annotations on fields in a class to help find elements easily.
Regards,
Simon