1

I am using python and selenium automation to toggle a switch on chrome://extensions/ . On the top of the website, there is an toggle for developer mode, and I am trying to use

driver.find_element_by_id("knob").click()

however, this doesnt find the element named ID. Does anyone know how I might select the element to toggle Developer mode?

Marco Bonelli
  • 63,369
  • 21
  • 118
  • 128
Luke Vanzweden
  • 466
  • 3
  • 15

1 Answers1

2

That element is inside ShadowDOM so you need to explicitly access it,
see Accessing Shadow DOM tree with Selenium.

A simpler solution seems to be to call the internal API directly:

driver.execute_script('''
  document.querySelector("extensions-manager")
    .delegate.setProfileInDevMode(true)
''')
wOxxOm
  • 65,848
  • 11
  • 132
  • 136