Created
October 9, 2013 12:54
-
-
Save pricees/6900781 to your computer and use it in GitHub Desktop.
Morningstar Scraper in progress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'capybara' | |
| require 'capybara/dsl' | |
| require "selenium-webdriver" | |
| Capybara.run_server = false | |
| Capybara.app_host = 'http://financials.morningstar.com' | |
| Capybara.register_driver :auto_dl do |app| | |
| profile = Selenium::WebDriver::Firefox::Profile.new | |
| profile["browser.download.useDownloadDir"] = true | |
| profile['browser.download.dir'] = "/tmp/webdriver-downloads" | |
| profile['browser.download.folderList'] = 0 # 0 = desktop 2 | |
| profile["browser.helperApps.neverAsk.saveToDisk"] = "text/plain, application/csv, application/vnd.ms-excel, text/csv, text/comma-separated-values, application/octet-stream" | |
| Capybara::Selenium::Driver.new(app, browser: :firefox, :profile => profile) | |
| end | |
| #Capybara.default_driver = :auto_dl | |
| #Capybara.javascript_driver = :auto_dl | |
| Capybara.current_driver = :auto_dl | |
| module MyCapybaraTest | |
| class Test | |
| include Capybara::DSL | |
| def test_morning_star(symbol) | |
| visit "/income-statement/is.html?t=#{symbol}" | |
| within(".icon_1_span") do | |
| click_link('') | |
| end | |
| end | |
| end | |
| end | |
| t = MyCapybaraTest::Test.new | |
| %w[OUTR AAPL MSFT GLNG].each { |symbol| t.test_morning_star(symbol); exit } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment