I recently finished a job search for a telecommuting job.  In the
course of that, I found that craigslist.org has the best job listings.
 However, craigslist doesn't allow you to search the whole country for
jobs, you have to go state-by-state and city-by-city.

I hadn't coded anything in Watir for some time, so I wrote a script
that searches every city in every state on craigslist for
telecommuting jobs.  It was really effective.  I had very interesting
conversations with companies in Maine and Montana, for instance.

It's in my interest to promote telecommuting in general, so I'm
contributing this script hoping that it adds just that much more
general interest to the subject of telecommuting for software testing
jobs.

#################################
require 'watir'
include Watir

def do_search
  jobs_links = []
  @ie.text_field(:index, 1).set("qa")
  [EMAIL PROTECTED](:index, 1).set("software test")
  @ie.select_list(:index,1).set("jobs")
  @ie.button(:index,1).click
  @ie.checkbox(:value, "telecommuting").set
  @ie.button(:index,1).click

  unless @ie.html =~ /Nothing found for/
  @ie.links.each do |j_link|
    if j_link.href =~ /\d+.html$/
      @outfile.puts(j_link)
      @outfile.puts("")
      end #if
    end #do
end #unless
@ie.back
@ie.back
  end #def

def click_cities
  @city_links = []
  @ie.links.each do |c_link|
    if ((c_link.text != "craigslist") and (c_link.text != "w") and
(c_link.text != "or suggest a new one"))
      @city_links << c_link
      end #if
    end #do

    @city_links.each do |cit_link|
      cit_link.click
      do_search
      @ie.back
    end #do

  end #def

@ie = IE.new

@ie.goto("http://craigslist.org";)
@state_links = []
@small_state_links = []
@city_links = []
@outfile = File.new("jobslinks3.txt", "w+")
@small_states = ["alaska","guam","delaware","dc","montana","n hampshire",
                         "puerto rico","rhode island",
                         "south dakota","wyoming","hawaii","maine","vermont"]

@ie.links.each do |link|
  if link.href =~ /geo.craigslist.org\/iso\/us/
    unless link.text == "us cities"
      if @small_states.include?(link.text)
  #puts link.text
        @small_state_links << link
      else
#puts link
         @state_links << link
      end #if
    end #unless
  end #if
end #do

@state_links.each do |state_link|
  state_link.click
  click_cities
  @ie.back
end

@small_state_links.each do |small_link|
  small_link.click
  do_search
  @ie.back
  end
_______________________________________________
Wtr-general mailing list
[EMAIL PROTECTED]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to