title: Sharing a pool of Selenium instances with asyncio
body: <p>I have a pool of selenium instances created this way:</p>
  <pre><code>selenium_instances = [
  webdriver.Chrome(executable_path=r&quot;C:\Program Files\ChromeDriver\chromedriver.exe&quot;),
  webdriver.Chrome(executable_path=r&quot;C:\Program Files\ChromeDriver\chromedriver.exe&quot;),
  webdriver.Chrome(executable_path=r&quot;C:\Program Files\ChromeDriver\chromedriver.exe&quot;)]
  </code></pre>
  <p>Then I have an asyncio event that can be called at random times.</p>
  <p>I would like it to take the first available instance of <code>selenium_instances</code> and lock it until it is done, if there is none available I would like it to wait for a maximum of 5 minutes for one available.</p>
  <p>I trying googling asyncio lock but did not really understand how to do this in Python.</p>
  <p>What would be the correct way to do this?</p>