title: Selenium can't find element by class name
body: <p>I want to send a message to <a href="https://www.spareroom.co.uk/flatshare/flatshare_detail.pl?flatshare_id=13829371" rel="nofollow noreferrer">this webpage</a> with Python.</p>
  
  <p>It is to say to do the following but with Python:</p>
  
  <p><a href="https://i.stack.imgur.com/sZOyk.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sZOyk.gif" alt="introducir la descripción de la imagen aquí"></a></p>
  
  <p>That's why I tried the following script with Selenium:</p>
  
  <pre><code>#!/usr/bin/env python3
  
  from selenium import webdriver
  
  
  api_location = 'http://iphoneapp.spareroom.co.uk'
  api_search_endpoint = 'flatshares'
  api_details_endpoint = 'flatshares'
  
  location = 'http://www.spareroom.co.uk'
  details_endpoint = 'flatshare/flatshare_detail.pl?flatshare_id='
  
  def contact_room(room_id):
      url = '{location}/{endpoint}/{id}?format=json'.format(location=api_location, endpoint=api_details_endpoint, id=room_id)
      print(url)
      driver_path = 'C:\Program Files\chromedriver'
      driver = webdriver.Chrome(executable_path = driver_path )  # Optional argument, if not specified will search path.
      # Go to your page url
      driver.get(url)
      # Get button you are going to click by its id ( also you could use find_element_by_css_selector to get element by css selector)
      button_element = driver.find_element_by_class_name('button button--wide')
      button_element.click()
  </code></pre>
  
  <p>But it returns: </p>
  
  <pre><code>contact_room(14110387)
  
  (roo_env) (base) C:\Users\antoi\Documents\Programming\roomfinder&gt;python test_message.py
  http://iphoneapp.spareroom.co.uk/flatshares/14110387
  
  DevTools listening on ws://127.0.0.1:51038/devtools/browser/401513e8-f221-47f1-ba6b-a7b7f598d839
  Traceback (most recent call last):
    File "test_message.py", line 24, in &lt;module&gt;
      contact_room(14110387)
    File "test_message.py", line 21, in contact_room
      button_element = driver.find_element_by_class_name('button button--wide')
    File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 564, in find_element_by_class_name
      return self.find_element(by=By.CLASS_NAME, value=name)
    File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 978, in find_element
      'value': value})['value']
    File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
      self.error_handler.check_response(response)
    File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
      raise exception_class(message, screen, stacktrace)
  selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".button button--wide"}
    (Session info: chrome=77.0.3865.120)
  </code></pre>
  
  <p>While the button to access the messaging page is of the <code>button button--wide</code> class. In fact, in the source code there is:</p>
  
  <pre><code>&lt;a class="button button--wide" data-ga-event-category="Listing Details" data-ga-event-action="clicked" data-ga-event-label="contact-box-email" href="/flatshare/flatshare_detail.pl?flatshare_id=14110387&amp;amp;mode=contact&amp;amp;submode=byemail&amp;amp;flatshare_type=offered&amp;amp;search_id=896264077&amp;amp;search_results=%2Fflatshare%2F%3Fsearch_id%3D896264077%26&amp;amp;city_id=9&amp;amp;featured=&amp;amp;alert_id=&amp;amp;alert_type=&amp;amp;upgrade_required=0&amp;amp;" title="Email advertiser" rel="nofollow"&gt;&lt;span&gt;&lt;i class="far fa-envelope"&gt;&lt;/i&gt;&amp;nbsp;&amp;nbsp;Message&lt;/span&gt;&lt;/a&gt;
  </code></pre>
  
  <h1>Trying <code>find_element_by_css_selector('.button.button--wide')</code></h1>
  
  <p>Unfortunately, it tells me that I can't interact with the element:</p>
  
  <pre><code>(roo_env) (base) C:\Users\antoi\Documents\Programming\roomfinder&gt;python test_message.py
  http://iphoneapp.spareroom.co.uk/flatshares/14110387
  
  DevTools listening on ws://127.0.0.1:52677/devtools/browser/4965ddbe-4b24-4ae7-a7f5-e44a8cbf2eef
  Traceback (most recent call last):
    File "test_message.py", line 25, in &lt;module&gt;
      contact_room(14110387)
    File "test_message.py", line 23, in contact_room
      button_element.click()
    File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
      self._execute(Command.CLICK_ELEMENT)
    File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
      return self._parent.execute(command, params)
    File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
      self.error_handler.check_response(response)
    File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
      raise exception_class(message, screen, stacktrace)
  selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
    (Session info: chrome=77.0.3865.120)
  </code></pre>