How to open console in firefox python selenium?

Try to simulate the same procedure as a "regular" firefox window using the send_keys function:

from selenium.webdriver.common.keys import Keys
driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + Keys.SHIFT + 'k')

I know this is relatively old but I ran into this issue recently. I got firefox to automatically open devtools by passing in a browser process argument "-devtools".

Selenium: 3.14 geckodriver: 0.21.0 firefox: 61.0.1

  from __future__ import print_function

  from datetime import datetime
  import logging
  import os

  from selenium import webdriver
  from selenium.webdriver.firefox.options import Options as FirefoxOptions

  def before_scenario(context, scenario):
    logging.info("RUNNING: " + scenario.name)
    print("Browser Test starting.\n")

    options = FirefoxOptions()
    options.log.level = "trace"
    options.add_argument("-devtools")

    if 'headless' in os.environ and os.environ['headless'] == '1':
         options.headless = True

    context.driver = webdriver.Firefox(firefox_options=options)


    context.driver.maximize_window()

I have no firebug installed, this works on Macos:

from selenium.webdriver.common.keys import Keys
driver.find_element_by_tag_name("body").send_keys(Keys.COMMAND + Keys.ALT + 'k')