title: Select Page object class on runtime based on driver type
body: <p>So i am building a page object model framework for a mobile native app.
   I have separate classes for IOS and android page objects. I have used singelton design pattern to instantiate the driver based on OS type. Now i want my test case to reference the page object class on run time based on the OS type.How can i achieve this. As of now i have a testcase class TestHomepage,a page object class, a driver class which is initialising  driver based on OS type, a utility method to get OS type from onfig property file and a property file where i am storing OS type.Code i use in the page object class Homepage to initialize driver is</p>
  
  <pre><code>public Homepage() {
      driver = (AndroidDriver&lt;AndroidElement&gt;) TestBase.Instance;
  }
  
  // utility method and singleton design
  public static String os(){
      try {
          String OS=getobject("Os");
          return OS;
          } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
      return null;        
  }
  
  
  public static String OS=os();
  public static WebDriver Instance=null;
  public static void Initialize() throws IOException{
      if (Instance==null){
          if(OS.equalsIgnoreCase("Android"))
              Instance=capabilities();
  
          else if (OS.equalsIgnoreCase("IOS")){
              Instance=ioscap();
          }
      }
  
  }
  </code></pre>