title: Instantiate Selenium webdriver in every class?
body: <p>This is not specifically a Selenium issue but probably more my lack of Java knowledge. I am writing Selenium tests and trying to do them in an Object Oriented way. As a result every class I have instantiates the current webdriver in the constructor. This means that every single class has the same constructor. Is there a different approach I should use or a more 'Java-esque' solution?</p>
  
  <pre><code>public class Foo {
  WebDriver driver;
  
      public Foo(WebDriver driver){
          this.driver = driver;
      }
  
      public static String getFoo(){
          String newFoo = "example";
      }
  }
  </code></pre>
  
  <p>Then if I call Foo from another Class I have to pass the instantiated driver to it:</p>
  
  <pre><code>public class FooB {
  
      public static void doSomething(){
          Foo foo = new Foo(driver);
          foo.getFoo();
      }
  }
  </code></pre>