Issue
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
Solution
Only if you are in desperate and your OS is Windows, you can simply do this with adding AutoHotKey script to Python code. You can download AutoHK from here
Install AutoHK. Then you create new script in notepad: just put one short string
Send ^+J
and save it as script.ahk
. These actions will takes 2-3 minutes. Then call it in your code
browser.get("https://www.facebook.com/groups/GNexus5/")
import os
os.system("path_to_script.ahk/script.ahk")
and this gonna work :)
Answered By - Andersson
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.