title: How to create a single webdriver instance in Python?
body: <p>I am in the midst of creating an automation framework in python but I am stuck up in creating a single instance of web driver. 
  Here's an excerpt of my framework design:</p>
  
  <ol>
  <li>A separate Driver.py which has the set up to create a web driver instance</li>
  </ol>
  
  <pre>
  from selenium import webdriver
  
  class Driver:
      #creating a class variable
      Instance = None
  
          @staticmethod
          def Initialize():
              Instance = webdriver.Firefox()
              return Instance
  </pre>
  
  <ol start="2">
  <li>Use this file in all areas of framework like:</li>
  </ol>
  
  <pre>
  from Driver import Driver
  
  class LoginPage:
      @staticmethod
      def GoToURL():        
          Driver.Instance.get("sample url")
  
      @staticmethod
      def Login():
          Driver.Instance.find_element_by_id("session_key-login").send_keys("sample@gmail.com")
          Driver.Instance.find_element_by_id("session_password-login").send_keys("sample_password")
          Driver.Instance.find_element_by_id("btn-primary").click()
  </pre>
  
  <p>The problem is <strong>Driver.Instance.get()</strong> or for that matter <strong>Driver.Instance.find_element...</strong> are throwing errors. Probably, it is not recognizing Driver.Instance here.</p>