I\'m attempting to set the request header \'Referer\' to spoof a request coming from another site. We need the ability test that a specific referrer is used, which returns a
For those people using Python, you may consider using Selenium Wire, which can set request headers, as well as provide you with the ability to inspect requests and responses.
from seleniumwire import webdriver # Import from seleniumwire
# Create a new instance of the Firefox driver
driver = webdriver.Firefox()
# Set the request header using the `header_overrides` attribute
driver.header_overrides = {
'Referer': 'referer_string',
}
# All subsequent requests will now contain the Referer
driver.get('https://mysite')