I am trying to open developer console in chrome using selenium webdriver. I am doing
from selenium import webdriver
from selenium.webdriver.common import action_chains, keys
...
browser = webdriver.Chrome(executable_path="C:\chrm\chromedriver.exe") browser.get("https://www.facebook.com/groups/GNexus5/")
...
action = action_chains.ActionChains(browser)
action.send_keys(keys.Keys.CONTROL+keys.Keys.SHIFT+'j')
action.perform()
But it is not opening up developer console. I have tried other keys (just typing some key-strokes, control-selecting some element) and they are working.
I am using ChromeDriver
Tell selenium to include a ''auto-open-devtools-for-tabs'' when launching chrome, here is an example using nightwatch configuration:
...
chrome: {
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true,
chromeOptions: {
'args': ['incognito', 'disable-extensions', 'auto-open-devtools-for-tabs']
}
}
},
...
With pyautogui you can do the keyboard press and open the console in the tab you have in foucs.
import pyautogui
pyautogui.keyDown('ctrl')
pyautogui.keyDown('shift')
pyautogui.press('j')
pyautogui.keyUp('ctrl')
pyautogui.keyUp('shift')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With