You need to run selenium in proxy injection mode
java -jar selenium-server-standalone.jar -proxyInjectionMode
Then you can add custom request headers like this (in Python)
sel.start("addCustomRequestHeader=true") sel.add_custom_request_header("mycustomheader","automation") sel.open('http://www.google.com')
To find out if a custom header has been applied, check the tab on which the selenium server is running. In console messages you should see something like this
INFO - Command request: addCustomRequestHeader[mycustomheader, automation] on session INFO - Got result: OK on session
source share