How to use modify_headers extension for Firefox via Webdriver?



  • I'm trying to use modify_headers extension (because this feature will never be added to Webdriver) but without success.

    I use the following code:

    @profile = Selenium::WebDriver::Firefox::Profile.new
    @profile.add_extension('extensions/modify_headers-0.7.1.1-fx.xpi')
    @profile['modifyheaders.config.active'] = true
    @profile['modifyheaders.config.alwaysOn'] = true
    @profile['modifyheaders.config.openNewTab'] = true
    @profile['modifyheaders.config.migrated'] = true
    
    @profile['modifyheaders.headers.count'] = 1
    @profile['modifyheaders.headers.action0'] = 'Add'
    @profile['modifyheaders.headers.name0'] = 'some_name'
    @profile['modifyheaders.headers.value0'] = 'some_value'
    @profile['modifyheaders.headers.enabled0'] = true
    
    @browser = Selenium::WebDriver::Driver.for :firefox, :profile => @profile
    

    When I navigate to some page I see it as if I didn't modify header. What was wrong with this code?



  • I found which line of code causes this behavior:

    @profile['modifyheaders.config.migrated'] = true

    Final variant:

    @profile.add_extension('support/add_ons/modify_headers-0.7.1.1-fx.xpi')
    @profile['modifyheaders.config.active'] = true
    @profile['modifyheaders.config.alwaysOn'] = true
    @profile['modifyheaders.config.openNewTab'] = true
    @profile['modifyheaders.start'] = true
    
    @profile['modifyheaders.headers.count'] = 1
    @profile['modifyheaders.headers.action0'] = 'Add'
    @profile['modifyheaders.headers.name0'] = 'some_name'
    @profile['modifyheaders.headers.value0'] = 'some_value'
    @profile['modifyheaders.headers.enabled0'] = true
    
    @browser = Selenium::WebDriver::Driver.for :firefox, :profile => @profile
    


Suggested Topics