https://bugzilla.wikimedia.org/show_bug.cgi?id=62839
Bug ID: 62839
Summary: make it possible to launch Firefox (and/or Chrome)
with a custom profile
Product: Wikimedia
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: Unprioritized
Component: Quality Assurance
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Web browser: ---
Mobile Platform: ---
Created attachment 14861
--> https://bugzilla.wikimedia.org/attachment.cgi?id=14861&action=edit
from
https://git.wikimedia.org/tree/mediawiki%2Fextensions%2FMobileFrontend/1f24f2429471925fbb52324293acbd7599aa5ec2/tests%2Fbrowser%2Ffeatures%2Fsupport
From time to time it is useful to override default settings for Firefox in a
browser test. The way to do this is to point Firefox at a custom Profile when
the browser starts. This custom profile takes the form of a local SQLite file
that Firefox will read upon starting.
In particular, it could be useful to allow access to the browser's geolocation
information without having to manually answer the browser query.
Jeff Hall and I spiked this in early 2014 but never got it completely working.
Our spike code was in the MobileFrontend env.rb file:
if user_agent =="default" && !ENV["NEARBY_FIREFOX"]
browser = Watir::Browser.new browser_label
else
if browser_label == :firefox && !ENV["NEARBY_FIREFOX"]
profile = Selenium::WebDriver::Firefox::Profile.new
profile["general.useragent.override"] = user_agent
browser = Watir::Browser.new browser_label, :profile => profile
else
if ENV["NEARBY_FIREFOX"]
permissions_file = "./features/support/permissions.sqlite"
if RUBY_PLATFORM =~ /darwin/
firefox_executable =
"/Applications/Firefox.app/Contents/MacOS/firefox"
elsif RUBY_PLATFORM =~ /linux/
firefox_executable = '/usr/bin/firefox'
else
puts 'Cannot identify local OS, so cannot locate Firefox executable!'
end
profile_path = ("/tmp/NearbyProfile/")
Dir.mkdir(profile_path) unless File.exists?(profile_path)
system(firefox_executable + " -CreateProfile 'NearbyProfile " +
profile_path + "'")
system("cp " + permissions_file + " " + profile_path)
browser = Watir::Browser.new :firefox, :profile => 'NearbyProfile'
else
raise "Changing user agent is currently supported only for Firefox!"
end
end
end
--
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l