Created
January 29, 2012 16:33
-
-
Save kingbin/1699540 to your computer and use it in GitHub Desktop.
automate testing a web project :)
This file contains hidden or 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
# Using the web automation driver (watir-webdriver) through the tor network | |
# Automates webpage actions & bypasses the voting limit on polldaddy | |
# Casts a vote every 3 seconds for a total of 1000 votes | |
require 'watir-webdriver' | |
profile = Selenium::WebDriver::Firefox::Profile.new | |
profile.proxy = Selenium::WebDriver::Proxy.new :http => '127.0.0.1:8118' | |
b = Watir::Browser.new :firefox, :profile => profile | |
#b = Watir::Browser.new :firefox | |
b.goto 'speakimge.wordpress.com/2012/01/25/under-the-covers/' | |
(1..1000).each do |i| | |
b.radio(:id => 'PDI_answer26523547').set | |
b.link(:id => 'pd-vote-button5876349').click | |
b.link(:href, 'javascript:PDV_go5876349();').click | |
puts 'Another vote! ' #<< b.span(:class => 'pds-feedback-votes').text.to_s | |
sleep(3) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mehh If you have tor running you can add these lines instead of line 7 and it should work through Tor
profile['network.proxy.socks'] = 'localhost'
profile['network.proxy.socks_port'] = 9150
profile['network.proxy.type'] = 1
Comes from the Selenium documentation.