title: A good working example of Selenium2 and webdriver
body: <p>I've been using selenium 1, but now want to migrate to selenium2/webdriver. To be honest, I find a little bit difficult to start with selenium2/webdriver. In essence I don't know how to work between page objects. Here is my example:</p>
  
  <pre><code>public class LoginPage {
      private final WebDriver driver;
  
      public LoginPage(WebDriver driver) {
          this.driver = driver; 
      }
  
      public void loginAs(String username, String password) {
          driver.get("http://url_to_my_webapp");        
          driver.findElement(By.id("username")).sendKeys(username);
          driver.findElement(By.id("pwd")).sendKeys(password);
          driver.findElement(By.className("button")).submit();                  
      }
  
      public static void main(String[] args){
          LoginPage login = new LoginPage(new FirefoxDriver());
          login.loginAs("user", "pass");
      }
  }
  </code></pre>
  
  <p>Now, after user is logged in, a redirection to different page occurs. As far as I understand, I should  now make a new page object that represents current page... The fact is I don't know how? Where can I find some good working examples which are going beyond "hello world" level?
  How should I continue this example?</p>
  
  <p>Thanks in advance!</p>