Created
April 20, 2012 10:16
-
-
Save natritmeyer/2427601 to your computer and use it in GitHub Desktop.
Example ruby/applescript combo that brings browsers to the front - useful in browser test automation...
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
#you probably only need one of these, but here's the lot of them... | |
#prepare the commands that will bring the various browsers to the front | |
bring_chrome_to_front = %Q{ osascript -e "tell application \\\"Google Chrome\\\" to activate" } | |
bring_firefox_to_front = %Q{ osascript -e "tell application \\\"Firefox\\\" to activate" } | |
#execute the applescript commands to bring the browsers to the front | |
`#{bring_chrome_to_front}` | |
`#{bring_firefox_to_front}` | |
#prepare the commands that will resize the various browser | |
resize_chrome_window = %Q{osascript -e "tell application \\\"Google Chrome\\\" to set bounds of window 1 to {1,1,1300,740}"} | |
resize_firefox_window = %Q{osascript -e "tell application \\\"Firefox\\\" to set bounds of window 1 to {1,1,1300,740}"} | |
#execute the commands to resize the browser window | |
`#{resize_chrome_window}` | |
`#{resize_firefox_window}` |
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
bring_chrome_to_front = %Q{ osascript -e "tell application \\\"Google Chrome\\\" to activate" } | |
`#{bring_chrome_to_front}` | |
resize_chrome_window = %Q{osascript -e "tell application \\\"Google Chrome\\\" to set bounds of window 1 to {1,1,1300,740}"} | |
`#{resize_chrome_window}` |
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
bring_firefox_to_front = %Q{ osascript -e "tell application \\\"Firefox\\\" to activate" } | |
`#{bring_firefox_to_front}` | |
resize_firefox_window = %Q{osascript -e "tell application \\\"Firefox\\\" to set bounds of window 1 to {1,1,1300,740}"} | |
`#{resize_firefox_window}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment