title: Python - Beautifulsoup | ValueError: Unsupported or invalid CSS selector: "<div"
body: <p>I an trying to scrape an application off of the fareham.gov.uk web page and every time I try it returns an error instead of the reference number. Can somebody help me to fix this problem? I am new to web scraping and whenever I try to google a fix nothing worked.</p>
  
  <p>Error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Users\DBaldwin\Desktop\sel.py", line 39, in &lt;module&gt;
      div = soup.select('&lt;div Class="docGridRow"&gt;&lt;div Class="detailsCells detailsFieldNames"&gt;Reference&lt;/div&gt;&lt;div Class="detailsCells detailsValues"&gt;')
    File "C:\Users\DBaldwin\Anaconda3\lib\site-packages\bs4\element.py", line 1477, in select
      'Unsupported or invalid CSS selector: "%s"' % token)
  ValueError: Unsupported or invalid CSS selector: "&lt;div"
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>import time
  import urllib.request
  from bs4 import BeautifulSoup
  from selenium import webdriver
  
  url = "http://www.fareham.gov.uk/casetrackerplanning/applicationsearch.aspx"
  
  driver = webdriver.Chrome(executable_path=r"C:\Users\DBaldwin\Desktop\chromedriver.exe")
  driver.get(url)
  
  driver.find_element_by_id("lnkAllowCookies").click()
  
  def rerun():
      driver.find_element_by_id("BodyPlaceHolder_uxLinkButtonShowAdvancedSearch").click()
  
      time.sleep(3)
  
      driver.find_element_by_id("uxStartDateDecisionTextBox").click()
      driver.find_element_by_id("uxStartDateDecisionTextBox").clear()
      driver.find_element_by_id("uxStartDateDecisionTextBox").send_keys("1/8/2018")
  
      driver.find_element_by_id("uxStopDateDecisionTextBox").click()
      driver.find_element_by_id("uxStopDateDecisionTextBox").clear()
      driver.find_element_by_id("uxStopDateDecisionTextBox").send_keys("308/2018")
  
      driver.find_element_by_id("BodyPlaceHolder_uxButtonSearch").click()
  
      time.sleep(3)
  
  rerun()
  
  elements = driver.find_elements_by_class_name("searchResultsCell")
  
  for e in elements:
      e.click()
      newUrl = driver.current_url
      go = urllib.request.urlopen(newUrl)
      soup = BeautifulSoup(go.read(), "html.parser")
      div = soup.select('&lt;div Class="docGridRow"&gt;&lt;div Class="detailsCells detailsFieldNames"&gt;Reference&lt;/div&gt;&lt;div Class="detailsCells detailsValues"&gt;')
      test = div[0].get_text()
      print(test)
      driver.back()
      rerun()
      print("Worked???")
  </code></pre>