Monday, August 13, 2012

Use Selenium to extract web page contents that delays loading

$>gem install selenium-webdriver

require 'rubygems'
require 'selenium-webdriver'

driver = Selenium::WebDriver.for :firefox
driver.manage.timeouts.implicit_wait = 10 # seconds
driver.get "http://food.clickthecity.com/b/sn10f81/jollibee-paco"

phone_number = driver.find_element(:css, 'section#content section#heading div#main-info p span')
puts phone_number.text

driver.quit

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.