title: Selenium Timeout with Heroku
body: <p>I intend to create an app with Selenium (python) hosted on Heroku, that uses discord in the browser</p>
  <pre><code>import os
  
  chrome_options = webdriver.ChromeOptions()
  chrome_options.binary_location = os.environ.get(&quot;GOOGLE_CHROME_BIN&quot;)
  chrome_options.add_argument(&quot;--headless&quot;)
  chrome_options.add_argument(&quot;--disable-dev-shm-usage&quot;)
  chrome_options.add_argument(&quot;--no-sandbox&quot;)
  
  def sampleCode():
      # CHROMEDRIVER_PATH is a config var in Heroku, set to '/app/.chromedriver/bin/chromedriver'
      b = webdriver.Chrome(executable_path=os.environ.get(&quot;CHROMEDRIVER_PATH&quot;), chrome_options=chrome_options)
      
  
      b.get('https://discord.com/channels/@me')
      wait = WebDriverWait(b, 10)
  
      # Find the email input part, and enter the email set as a config var in Herkou
      email = b.find_element_by_name('email')
      email.send_keys(os.environ.get('username'))
  
      # Find the password input part, and enter the password set as a config var in Herkou
      password = b.find_element_by_name('password')
      password.send_keys(os.environ.get('password'))
  
      # Clicks the login button
      b.find_element_by_css_selector('selectorGoesHere').click()
  
      # At this point, the browser should have filled in and submitted the login form (https://discord.com/login) and moved into the main application (https://discord.com/channels/@me)
      # b.get('https://discord.com/channels/@me') redirects to https://discord.com/login btw
  
      settings = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, 'selectorGoesHere')))
      settings.click()
  
  sampleCode()
  
  </code></pre>
  <p>I get an error from Selenium:</p>
  <pre><code>raise TimeoutException(message, screen, stacktrace)
  selenium.common.exceptions.TimeoutException: Message:
  </code></pre>
  <p>The error message refers to when I defined the settings variable
  This means that Selenium could not find the element that I looked for (which is a settings button)</p>
  <p>HOWEVER, when I run this same code but without the stuff for Heroku (so no chrome_options stuff, and <code>b = webdriver.Chrome()</code>, it works perfectly. This leads me to believe that it might have something to do with --headless or the other args.</p>
  <p>All of the Heroku stuff that I set up followed this tutorial (you can read the blog post or watch the video): <a href="https://www.andressevilla.com/running-chromedriver-with-python-selenium-on-heroku/" rel="nofollow noreferrer">https://www.andressevilla.com/running-chromedriver-with-python-selenium-on-heroku/</a></p>
  <p>Other imports include:</p>
  <pre><code>from selenium import webdriver
  from selenium.webdriver.support.ui import WebDriverWait
  from selenium.webdriver.support import expected_conditions as EC
  from selenium.webdriver.common.by import By
  from selenium.common.exceptions import TimeoutException
  from selenium.webdriver.common.keys import Keys
  import threading
  from selenium.webdriver.support import expected_conditions as EC
  from selenium.webdriver.common.by import By
  </code></pre>
  <p>I want to reemphasize that everything works without the <code>chrome_options</code> and Heroku when I run <code>python Main.py</code></p>