Created
October 18, 2012 15:29
-
-
Save michaelminter/3912576 to your computer and use it in GitHub Desktop.
Revisions
-
michaelminter revised this gist
Oct 20, 2012 . 1 changed file with 31 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ #!/usr/bin/ruby require 'rubygems' require 'watir-webdriver' o = [('a'..'z'),('A'..'Z'),(0..9)].map{|i| i.to_a}.flatten string = (0...8).map{ o[rand(o.length)] }.join # settings username = "[email protected]" password = "password" imagepath = "/assets/locations/github.gif" # create new instance browser = Watir::Browser.new browser.goto "https://twitter.com/" # login browser.text_field(:id => "signin-email").set username browser.text_field(:id => "signin-password").set password browser.button(:class => "js-submit").click # change profile settings browser.goto "https://twitter.com/settings/password" # sleep(2) browser.text_field(:id => 'current_password').set password browser.text_field(:id => 'user_password').set string browser.text_field(:id => 'user_password_confirmation').set string browser.button(:id => "settings_save").click # sleep(2) puts browser.text.include? 'Your password has been changed' puts string -
michaelminter revised this gist
Oct 18, 2012 . 1 changed file with 20 additions and 18 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,23 +1,25 @@ #!/usr/bin/ruby require 'rubygems' require 'watir-webdriver' # settings username = "USERNAME" password = "PASSWORD" imagepath = "/Users/alex/image.png" # create new instance browser = Watir::Browser.new browser.goto "https://twitter.com/" # login browser.text_field(:id => "signin-email").set username browser.text_field(:id => "signin-password").set password browser.button(:class => "js-submit").click # change profile settings browser.goto "https://twitter.com/settings/profile" sleep(1) browser.button(:id => "profile_image_upload").click browser.file_field(:class => "file-input").send_keys(imagepath) sleep(2) browser.link(:text => "Save").click -
michaelminter created this gist
Oct 18, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ require 'watir-webdriver' # update with your credentials username = "username" password = "pass" photo = "/path/to/photo.jpeg" b = Watir::Browser.new :chrome b.goto 'twitter.com' b.text_field(:id => 'signin-email').set username b.text_field(:id => 'signin-password').set password b.button(:class => 'submit btn primary-btn flex-table-btn js-submit').click b.goto 'twitter.com/settings/profile' sleep(5) b.button(:id => 'profile_image_upload').click b.file_field(:name, "media[]").set photo l = b.link :text => 'Save' l.exists? l.click 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ require 'watir-webdriver' # update with your credentials username = "username" password = "pass" photo = "/path/to/photo.jpeg" b = Watir::Browser.new :chrome b.goto 'twitter.com' b.text_field(:id => 'signin-email').set username b.text_field(:id => 'signin-password').set password b.button(:class => 'submit btn primary-btn flex-table-btn js-submit').click b.goto 'twitter.com/settings/profile' sleep(5) b.button(:id => 'profile_image_upload').click b.file_field(:name, "media[]").set photo l = b.link :text => 'Save' l.exists? l.click