title: Selenium Python Twitter. Problem when HeadLess = True
body: <p>I have done the next function to use twitter with Selenium.</p>
  <p>If i put the HeadLess = False, it works perfect but when I put HeadLess = True, it doesnt find the elements by the class.</p>
  <p>Some Help?</p>
  <pre><code>opciones=Options()
  
  opciones.add_experimental_option('excludeSwitches', ['enable-automation'])
  opciones.add_experimental_option('useAutomationExtension', False)
  
  opciones.headless=False
  
  
  def twittear():    
      
      url = 'https://twitter.com/login'
      driver=webdriver.Chrome(PATH, options=opciones)
      driver.get(url)
      
      try:
          # cookies
          driver.find_element_by_class_name('css-901oao css-16my406 css-bfa6kz r-poiln3 r-a023e6 r-rjixqe r-bcqeeo r-qvutc0'.replace(' ', '.')).click()
          time.sleep(1)
  
      except:
          
          None
      
      
      # Introduzco el mail
      
      time.sleep(10)
      
      driver.find_element_by_class_name('r-30o5oe r-1niwhzg r-17gur6a r-1yadl64 r-deolkf r-homxoj r-poiln3 r-7cikom r-1ny4l3l r-t60dpp r-1dz5y72 r-fdjqy7 r-13qz1uu'.replace(' ', '.')).send_keys(user)
      time.sleep(2)                     
      driver.find_element_by_class_name('r-30o5oe r-1niwhzg r-17gur6a r-1yadl64 r-deolkf r-homxoj r-poiln3 r-7cikom r-1ny4l3l r-t60dpp r-1dz5y72 r-fdjqy7 r-13qz1uu'.replace(' ', '.')).send_keys(u'\ue007')                    
  
      time.sleep(3)
      
      
      # Introduzco username
      driver.find_element_by_class_name('r-30o5oe r-1niwhzg r-17gur6a r-1yadl64 r-deolkf r-homxoj r-poiln3 r-7cikom r-1ny4l3l r-t60dpp r-1dz5y72 r-fdjqy7 r-13qz1uu'.replace(' ', '.')).send_keys(user)
      driver.find_element_by_class_name('r-30o5oe r-1niwhzg r-17gur6a r-1yadl64 r-deolkf r-homxoj r-poiln3 r-7cikom r-1ny4l3l r-t60dpp r-1dz5y72 r-fdjqy7 r-13qz1uu'.replace(' ', '.')).send_keys(u'\ue007')   
      
      time.sleep(3)
      
      # Introduzco password
      driver.find_element_by_class_name('r-30o5oe r-1niwhzg r-17gur6a r-1yadl64 r-deolkf r-homxoj r-poiln3 r-7cikom r-1ny4l3l r-t60dpp r-1dz5y72 r-fdjqy7 r-13qz1uu'.replace(' ', '.')).send_keys(password)
      driver.find_element_by_class_name('r-30o5oe r-1niwhzg r-17gur6a r-1yadl64 r-deolkf r-homxoj r-poiln3 r-7cikom r-1ny4l3l r-t60dpp r-1dz5y72 r-fdjqy7 r-13qz1uu'.replace(' ', '.')).send_keys(u'\ue007')   
      
      time.sleep(3)
  
      # Twitt
      driver.find_element_by_class_name('public-DraftStyleDefault-block public-DraftStyleDefault-ltr'.replace(' ', '.')).send_keys(gift_link)
      driver.find_element_by_class_name('css-18t94o4 css-1dbjc4n r-l5o3uw r-42olwf r-sdzlij r-1phboty r-rs99b7 r-19u6a5r r-2yi16 r-1qi8awa r-1ny4l3l r-ymttw5 r-o7ynqc r-6416eg r-lrvibr'.replace(' ', '.')).click()
  </code></pre>