Advertisement
Guest User

Untitled

a guest
Apr 21st, 2012
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.08 KB | None | 0 0
  1. require 'rubygems'
  2. require 'watir-webdriver'
  3. http = Selenium::WebDriver::Remote::Http::Default.new
  4. http.timeout = 100
  5. b=Watir::Browser.new(:chrome, :http_client => http)
  6.  
  7. b.goto('gmail.com')
  8. b.text_field(:id,'Email').set("Alex@pathjoy.com")
  9. b.text_field(:id,'Passwd').set("Manonthemoon1")
  10. b.button(:id,'signIn').click
  11. sleep(1)
  12.  
  13. b.goto('task.fm/signin')
  14. b.text_field(:id,'email').set('Alexc@task.fm')
  15. b.text_field(:id,'password').set('Manonthemoon1')
  16. b.button(:id,'signinButton').click
  17. sleep(1)
  18.  
  19. html=File.open('finalquestions.txt')
  20. lines=html.readlines
  21.  
  22. j=0
  23. for line in lines
  24.     j=j+1
  25.     puts j
  26.     keywords=line.scan(/([^|]+)/)
  27.     keyword=keywords[0]
  28.     council=keywords[1]
  29.     question=keywords[2]
  30.  
  31.     (0...keyword.length).each do |i|
  32.         keyword=keyword[i]
  33.         council=council[i]
  34.         question=question[i]
  35.  
  36.         puts keyword
  37.         puts question
  38.         puts council
  39.    
  40.         b.goto('task.fm/admin/add_question')
  41.         b.text_field(:name,'title').set(question)
  42.         b.text_field(:name,'keyword').set(keyword)
  43.         b.text_fields[3].set(council)
  44.  
  45.         b.wait_until{b.h2(:text,'Question added.').exists?}
  46.     end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement