Created
March 17, 2012 12:01
-
-
Save bobbychopra/2058081 to your computer and use it in GitHub Desktop.
Watir script to scrape data from 1st page of Naukri
This file contains 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
#!/usr/bin/env ruby | |
################################################## | |
## Sample script for friend to pull some info ## | |
## from the website ... Only did it for 1 page ## | |
################################################## | |
require 'rubygems' | |
require 'safariwatir' | |
browser = Watir::Safari.new | |
browser.goto 'http://www.naukri.com' | |
browser.text_field(:id, 'ql').set 'Mumbai' | |
browser.button(:id, 'search').click | |
# Get job listings .... | |
joblinks = browser.links.find_all {|link| link.title == "View & Apply" } | |
joblinks.each do |link| | |
puts '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>' | |
puts link.strong(:index, 1).html | |
# puts link.b(:index, 1).html | |
# puts link.i(:index, 1).html | |
puts link.em(:index, 1).html | |
end | |
puts joblinks.length | |
puts 'DONE!!!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment