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

323
Views
How to control on chrome://settings/content/siteDetails?site=??? via selenium python

I tried to change site setting via selenium and I found answer to allow ads and pop_up for specific website the answer was:

self.driver.get(f'chrome://settings/content/siteDetails?site={link}')

        temp= self.driver.execute_script(
            "return document.querySelector('settings-ui').shadowRoot.querySelector('settings-main#main').shadowRoot.querySelector('settings-basic-page')")
        rules = self.driver.execute_script(
            "return arguments[0].shadowRoot.querySelector('settings-privacy-page').shadowRoot.querySelector('settings-animated-pages#pages settings-subpage site-details').shadowRoot.querySelector('div.list-frame:not(div>div.list-frame)')", temp)
        Ads = self.driver.execute_script(
            "return arguments[0].querySelector('site-details-permission[label=\"Ads\"]').shadowRoot.querySelector('#permission')", rules)
        Pop_ups =  self.driver.execute_script(
            "return arguments[0].querySelector('site-details-permission[label=\"Pop-ups and redirects\"]').shadowRoot.querySelector('#permission')", rules)
        Ads.click()
        Ads.find_element_by_id("allow").click()
        Pop_ups.click()
        Pop_ups.find_element_by_id('allow').click()

but when I tried it with --headless as chrome driver option didn't work and this is the error:

Exception has occurred: JavascriptException
Message: javascript error: Cannot read properties of null (reading 'shadowRoot')
  (Session info: headless chrome=96.0.4664.110)

how did I use this code with headless option? there is another Solution if I want to allow ads and popups?

about 4 years ago · Santiago Trujillo
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!