Created
May 10, 2012 00:24
-
-
Save drinks/2650021 to your computer and use it in GitHub Desktop.
Log in to Google+ hangout via Selenium
This file contains 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
#!/usr/bin/env ruby | |
### make sure you `brew install chromedriver` and `gem install selenium-webdriver` before running this! | |
require 'rubygems' | |
require 'selenium-webdriver' | |
# maximize this mofo | |
profile = Selenium::WebDriver::Chrome::Profile.new | |
profile['browser.window_placement.top'] = 0 | |
profile['browser.window_placement.left'] = 0 | |
profile['browser.window_placement.right'] = 1280 # or whatever your display resolution is... | |
profile['browser.window_placement.bottom'] = 720 | |
# go to stupid splash screen | |
browser = Selenium::WebDriver.for :chrome, :profile => profile | |
wait = Selenium::WebDriver::Wait.new :timetout => 20 | |
browser.navigate.to 'http://bit.ly/my-hangout' | |
browser.find_element(:class, 'gQb').click | |
# log in to g+ | |
wait.until { browser.find_element(:id => 'Email') } | |
browser.find_element(:id, 'Email').send_keys('[email protected]') | |
browser.find_element(:id, 'Passwd').send_keys('my_password') | |
browser.find_element(:id, 'signIn').click | |
# log in to hangout | |
wait.until { browser.find_elements(:class, 'N-Q-pb')[0] } | |
wait.until { browser.find_elements(:class, 'N-Q-pb')[0].displayed? } | |
browser.find_elements(:class, 'N-Q-pb')[0].click | |
### Tell the AppleScript to put chrome in the foreground after running this! |
This file contains 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
do shell script "hangout" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment