Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'watir-webdriver'
- http = Selenium::WebDriver::Remote::Http::Default.new
- http.timeout = 100
- b=Watir::Browser.new(:chrome, :http_client => http)
- b.goto('gmail.com')
- b.text_field(:id,'Passwd').set("Manonthemoon1")
- b.button(:id,'signIn').click
- sleep(1)
- b.goto('task.fm/signin')
- b.text_field(:id,'password').set('Manonthemoon1')
- b.button(:id,'signinButton').click
- sleep(1)
- html=File.open('finalquestions.txt')
- lines=html.readlines
- j=0
- for line in lines
- j=j+1
- puts j
- keywords=line.scan(/([^|]+)/)
- keyword=keywords[0]
- council=keywords[1]
- question=keywords[2]
- (0...keyword.length).each do |i|
- keyword=keyword[i]
- council=council[i]
- question=question[i]
- puts keyword
- puts question
- puts council
- b.goto('task.fm/admin/add_question')
- b.text_field(:name,'title').set(question)
- b.text_field(:name,'keyword').set(keyword)
- b.text_fields[3].set(council)
- b.wait_until{b.h2(:text,'Question added.').exists?}
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement