title: Python Error: AttributeError: __enter__ using Selenium
body: <p>I am trying to run my selenium test, but I get an error.</p>
  <p>First, I am creating booking.py file, which contains Booking class:</p>
  <pre><code>from asyncio import selector_events
  from lib2to3.pgen2 import driver
  import booking.constants as const
  import os
  from selenium import webdriver
  from webdriver_manager.chrome import ChromeDriverManager
  from selenium.webdriver.chrome.service import Service
  from selenium.webdriver.common.by import By
  
  class Booking:
      def __init__(self, teardown = False):
          s = Service(ChromeDriverManager().install())
          self.driver = webdriver.Chrome(service=s)
          self.driver.get(const.BASE_URL)
          self.driver.teardown = teardown
          self.driver.implicitly_wait(15)
  
      def __exit__(self, exc_type, exc_val, exc_tb):
          if self.driver.teardown:
              self.driver.quit()
  
      def cookies(self):
          self.driver.find_element(By.ID, 'onetrust-accept-btn-handler').click()
  
      def select_place_to_go(self):
          self.driver.find_element(By.ID, &quot;ss&quot;).click()
  </code></pre>
  <p>Then, I have run.py file:</p>
  <pre><code>from booking.booking import Booking
  
  with Booking() as bot:
      bot.cookies()
      bot.select_place_to_go()
  </code></pre>
  <p>After running run.py file, I get an error:</p>
  <pre><code>AttributeError: __enter__
  </code></pre>
  <p>However, it works completely fine using this code:</p>
  <pre><code>bot = Booking()
  bot.cookies()
  bot.select_place_to_go()
  </code></pre>
  <p>Where is the problem?
  f you have any ideas about code improvements, please, let me know. Any help is appreciated, thank you!</p>