def self.click_link(link_spec,index = 0,wait_secs=0)
Scrubyt.log :ACTION, "Clicking link specified by: %p" % link_spec
if link_spec.is_a? Hash
clicked_elem = CompoundExampleLookup.find_node_from_compund_example(@@hpricot_doc, link_spec, false, index)
else
clicked_elem = SimpleExampleLookup.find_node_from_text(@@hpricot_doc, link_spec, false, index)
end
clicked_elem = XPathUtils.find_nearest_node_with_attribute(clicked_elem, 'href')
result_page = @@agent.click(clicked_elem)
@@current_doc_url = result_page.uri.to_s
Scrubyt.log :ACTION, "Fetching #{@@current_doc_url}"
fetch(@@current_doc_url, :mechanize_doc => result_page)
end