Last modified: 2014-10-19 17:43:55 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T64839, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 62839 - make it possible to launch Firefox (and/or Chrome) with a custom profile
make it possible to launch Firefox (and/or Chrome) with a custom profile
Status: NEW
Product: Wikimedia
Classification: Unclassified
Quality Assurance (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-19 16:48 UTC by Chris McMahon
Modified: 2014-10-19 17:43 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
from https://git.wikimedia.org/tree/mediawiki%2Fextensions%2FMobileFrontend/1f24f2429471925fbb52324293acbd7599aa5ec2/tests%2Fbrowser%2Ffeatures%2Fsupport (64.03 KB, application/octet-stream)
2014-03-19 16:48 UTC, Chris McMahon
Details

Description Chris McMahon 2014-03-19 16:48:19 UTC
Created attachment 14861 [details]
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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links