I'm currently using Selenium and BeautifulSoup to try to scrape financial statement data from Google Finance. For example:
http://www.google.com/finance?q=GOOG&fstype=ii
opens to Income Statement for Google. When I get Selenium to click the "Balance Statement" and "Cash Flow" buttons at the top of the page, the charts and tables on the page change, but the url doesn't change, and when I pull the page source, it is the original page with the Income Statement table. My code is posted below:
driver = webdriver.Firefox()
driver.get("http://www.google.com/finance?q=" + ticker[0] + "&fstype=ii")
url1 = driver.page_source
soup1 = BeautifulSoup(url1)
element = driver.find_element_by_xpath('//*[@id=":1"]/a/b/b')
element.click()
driver.implicity_wait(3.0)
url2 = driver.page_source
soup2 = BeautifulSoup(url2)
element = driver.find_element_by_xpath('//*[@id=":2"]/a/b/b')
element.click()
driver.implicity_wait(3.0)
url3 = driver.page_source
soup3 = BeautifulSoup(url3)
driver.quit()
Any help is appreciated. Thanks.