Created
September 30, 2014 08:40
-
-
Save kurtsson/380621b6018b271a034c to your computer and use it in GitHub Desktop.
To use a custom firefox profile for Selenium-webdriver in ruby
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
module Selenium | |
module WebDriver | |
module Firefox | |
class Profile | |
def layout_on_disk | |
firefox_profile = File.expand_path(File.join(File.dirname(__FILE__),'firefox_profile')) | |
profile_dir = create_tmp_copy(firefox_profile) | |
FileReaper << profile_dir | |
install_extensions(profile_dir) | |
delete_lock_files(profile_dir) | |
delete_extensions_cache(profile_dir) | |
update_user_prefs_in(profile_dir) | |
puts "Using temporary Firefox profile in: #{profile_dir} from #{firefox_profile}" | |
profile_dir | |
end | |
end | |
end # Firefox | |
end # WebDriver | |
end # Selenium |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment