maybe a static factory method in the page is the cleanest solution.

public class MyPage extends WebPage {
   private MyPage(String param) {
    ....
   }

   public static MyPage(String param) {
       return new MyPage(param);
   }

   public static MyPageInjected(String param) {
      MyPage p=new MyPage(param); SpringInjector.inject(p); return p;
   }
}

in conjunction with setters/getters this can be used cleanly in both testcases and code. its a little more code, but it is very clean.

-Igor

Reply via email to