This is the simplified, packaged extension for using ModHeader in Selenium WebDriver. For the Chrome version, look for chrome-modheader instead.
Installation:
npm install firefox-modheader
Usage
const { getExtension, getAddHeaderUrl } = require('firefox-modheader');
const options = new firefox.Options();
options.addExtensions(getExtension());
const driver = await new Builder()
.forBrowser('firefox')
.setFirefoxOptions(options)
.build();
await driver.get(getAddHeaderUrl('HeaderName', 'HeaderValue'));
API:
All APIs are URL-based. Please make sure to URL encode your name and value
properly.
You can use the getAddHeaderUrl()
and getClearHeadersUrl()
functions to
craft these URLs. Be sure to do driver.get()
, and be mindful that these
will change the URL of the WebDriver.
https://webdriver.bewisse.com/add?{name1}={value1}&{name2}={value2}&...
e.g., https://webdriver.bewisse.com/add?Test=1
https://webdriver.bewisse.com/clear
Load custom profile:
https://webdriver.bewisse.com/load?profile={exported_profile_in_json}
exported_profile_in_json can be obtained from the regular ModHeader
extension using ... -> Export Profile.