title: Scraping a table for links, click links & scrape data
body: <p>I have a table which I wish to pick up all the links, go through the link and scrape the items within td class=horse.</p>
  
  <p>The home page where the table is with all the links has the following code:</p>
  
  <pre><code>  &lt;table border="0" cellspacing="0" cellpadding="0" class="full-calendar"&gt;
      &lt;tr&gt;
          &lt;th width="160"&gt;&amp;nbsp;&lt;/th&gt;
          &lt;th width="105"&gt;&lt;a href="/FreeFields/Calendar.aspx?State=NSW"&gt;NSW&lt;/a&gt;&lt;/th&gt;
          &lt;th width="105"&gt;&lt;a href="/FreeFields/Calendar.aspx?State=VIC"&gt;VIC&lt;/a&gt;&lt;/th&gt;
          &lt;th width="105"&gt;&lt;a href="/FreeFields/Calendar.aspx?State=QLD"&gt;QLD&lt;/a&gt;&lt;/th&gt;
          &lt;th width="105"&gt;&lt;a href="/FreeFields/Calendar.aspx?State=WA"&gt;WA&lt;/a&gt;&lt;/th&gt;
          &lt;th width="105"&gt;&lt;a href="/FreeFields/Calendar.aspx?State=SA"&gt;SA&lt;/a&gt;&lt;/th&gt;
          &lt;th width="105"&gt;&lt;a href="/FreeFields/Calendar.aspx?State=TAS"&gt;TAS&lt;/a&gt;&lt;/th&gt;
          &lt;th width="105"&gt;&lt;a href="/FreeFields/Calendar.aspx?State=ACT"&gt;ACT&lt;/a&gt;&lt;/th&gt;
          &lt;th width="105"&gt;&lt;a href="/FreeFields/Calendar.aspx?State=NT"&gt;NT&lt;/a&gt;&lt;/th&gt;
      &lt;/tr&gt;  
  
  
      &lt;tr class="rows"&gt;
          &lt;td&gt;
              &lt;p&gt;&lt;span&gt;FRIDAY 13 JAN&lt;/span&gt;&lt;/p&gt;
          &lt;/td&gt;
  
                  &lt;td&gt;
                      &lt;p&gt;
  
                              &lt;a href="/FreeFields/Form.aspx?Key=2017Jan13,NSW,Ballina"&gt;Ballina&lt;/a&gt;&lt;br&gt;
  
                              &lt;a href="/FreeFields/Form.aspx?Key=2017Jan13,NSW,Gosford"&gt;Gosford&lt;/a&gt;&lt;br&gt;
  
                      &lt;/p&gt;
                  &lt;/td&gt;
  
                  &lt;td&gt;
                      &lt;p&gt;
  
                              &lt;a href="/FreeFields/Form.aspx?Key=2017Jan13,VIC,Ararat"&gt;Ararat&lt;/a&gt;&lt;br&gt;
  
                              &lt;a href="/FreeFields/Form.aspx?Key=2017Jan13,VIC,Cranbourne"&gt;Cranbourne&lt;/a&gt;&lt;br&gt;
  
                      &lt;/p&gt;
                  &lt;/td&gt;
  
                  &lt;td&gt;
                      &lt;p&gt;
  
                              &lt;a href="/FreeFields/Form.aspx?Key=2017Jan13,QLD,Doomben"&gt;Doomben&lt;/a&gt;&lt;br&gt;
  
                      &lt;/p&gt;
                  &lt;/td&gt;
  </code></pre>
  
  <p>I currently have the code to look up the table and print the links</p>
  
  <pre><code>from selenium import webdriver
  import requests 
  from bs4 import BeautifulSoup
  
  #path to chromedriver 
  path_to_chromedriver = '/Users/Kirsty/Downloads/chromedriver'
  
  #ensure browser is set to Chrome 
  browser = webdriver.Chrome(executable_path= path_to_chromedriver)
  
  #set browser to Racing Australia Home Page
  url = 'http://www.racingaustralia.horse/'
  r = requests.get(url)
  
  soup=BeautifulSoup(r.content, "html.parser")
  
  #looks up to find the table &amp; prints link for each page
  table = soup.find('table',attrs={"class" : "full-calendar"}). find_all('a')
   for link in table:
          print link.get('href')
  </code></pre>
  
  <p>Wondering if anyone can assist in how I can get the code to click on all the links that are within the table &amp; do the following to the each of the pages</p>
  
  <pre><code>g data = soup.findall("td",{"class":"horse"})
  for item in g_data:
     print item.text
  </code></pre>
  
  <p>Thanks in advance</p>