title: Selenium work around 'TimeoutException' is not defined?
body: <p>I want to <strong>work around</strong> the <strong>TimeOutException in Python Selenium.</strong></p>
  
  <p>This happens:</p>
  
  <pre><code>1.) Open Browser, Call URL
  2.) Trying to find Element
  2.1) Works sometimes
  2.2) Works not sometimes and throws TimeoutException
  3.) Should look for other elements
  </code></pre>
  
  <p>I can never reach step <code>3.)</code> after we have hit the exception in <code>2.2)</code> and try/catch does not work. </p>
  
  <p>After step <code>3.)</code> there are many other steps. How can I let the program flow around this timeout. It is timeouting when the element is not there.</p>
  
  <p><strong>Code</strong> </p>
  
  <pre class="lang-py prettyprint-override"><code>    def getByClass(InputElement, driver):
          getByClass = WebDriverWait(driver, timeout).until(EC.visibility_of_element_located((By.CLASS_NAME, InputElement)))
          return getByClass
  
      try:
          element = Dom.getByClass('test-class', driver).text
      except TimeoutException:
          element = 'element not found'
      print(element)
  </code></pre>
  
  <p><strong>Result</strong></p>
  
  <pre class="lang-py prettyprint-override"><code>    except TimeoutException:
      NameError: name 'TimeoutException' is not defined
  </code></pre>