title: Empty object returned in BeautifulSoup find_all method using a CSS selector
body: <p>I am using requests module in python to login into the results page. From there I want the program to print my name, marks etc on the terminal using bs4. While using 
  <code>name = soupe.find_all("td", {"class": "celldata"})</code>  or<br>
  <code>names = soupe.find_all(class_="celldata")</code> the code works perfectly. But when i copy the CSS selector for my name i.e</p>
  
  <pre><code>namess = soupe.find_all(r'body &gt; table &gt; tbody &gt; tr:nth-of-type(4) &gt; td &gt; div:nth-of-type(1) &gt; table &gt; tbody &gt; tr:nth-of-type(2) &gt; td:nth-of-type(3)')
  </code></pre>
  
  <p>This returned an empty object. I think it should have returned my name. What is the problem with this way?
  Also, can someone tell me when to use CSS selectors and when to do it manually.</p>
  
  <p>Another problem that I faced was that in post method when I gave the URL of the website where I had to fill the form i.e</p>
  
  <pre><code>http://kvpy.iisc.ernet.in/kvpy-1415/checkMarks.php
  </code></pre>
  
  <p>then the program did not work. I had to change it to the URL of the page which contained student's name and rank etc. i.e</p>
  
  <pre><code>http://kvpy.iisc.ernet.in/kvpy-1415/checkMarksSuccess.php
  </code></pre>
  
  <p>which comes after filling the form.
  why did this happen?</p>
  
  <p>Here is the full code:</p>
  
  <pre><code>import requests
  import bs4
  
  s = requests.Session()
  
  payload = {'id': '15015556', 'dd' : '25', 'mm' : '09', 'yyyy' : '1998'}
  
  r = s.post(r'http://kvpy.iisc.ernet.in/kvpy-1415/checkMarksSuccess.php', payload)
  
  if (r.text.find("Name of the Candidate")) &gt;= 0:
      soupe = bs4.BeautifulSoup(r.content, "lxml")
      name = soupe.findAll("td", {"class": "celldata"})
  
      names = soupe.find_all(class_="celldata")
  
      namess = soupe.find_all(r'body &gt; table &gt; tbody &gt; tr:nth-of-type(4) &gt; td &gt; div:nth-of-type(1) &gt; table &gt; tbody &gt; tr:nth-of-type(2) &gt; td:nth-of-type(3)')
      print (namess)
  
      '''for n in name:
          print(n.get_text())'''
  else:
      print("failure")
  </code></pre>