Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

320
Views
selenium driver.executscript modheader

I am building a web scraper using node js and selenium. Apparently selenium is not in the ability to modify the header of the get request. From what I read on stack overflow, this can be solved using the chrome extension ModHeader. However, when I try to use one of the predefined test headers, the extension loads but the predefined header is not present. I guess something is wrong with the driver.executscript() but not sure, since no error is thrown:

var driver = new Builder().forBrowser('chrome').setChromeOptions(new chrome.Options().addExtensions('ModHeader.crx')/*.headless()*/).build()

    driver.executeScript(function () {
        localStorage.setItem('profiles', JSON.stringify(
            [{"appendMode":false,"backgroundColor":"#6a83a1","filters":[],"headers":[{"comment":"","enabled":true,"name":"","value":""},{"comment":"","enabled":true,"name":"User-Agent","value":"'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36'"}],"hideComment":true,"respHeaders":[],"shortTitle":"1","textColor":"#ffffff","title":"Profile 1","urlReplacements":[],"alwaysOn":true}]
        )//end of stringify
        )//end of setItem

        
        
    })//end of executescript
    


driver.get("http://stackoverflow.com/")
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!