I have a code that basically triggers a browser shortcut using actionchains. I'm using Chrome driver 2.27 and running python 3.6 through Jupyter notebook(though that shouldn't matter). The problem is that if the code runs along with the creation of the webdriver instance it works and shows the download bar.
Instead if I run the code to create the webdriver, open the new window, minimize it and then try running the code to trigger the shortcut it doesn't work. I'm guessing it has something to do with the driver losing focus because I manually peek at the new window created.
Code to create the webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium import webdriver
chromedriver= "chromedriver_v2.27.exe"
driver = webdriver.Chrome(chromedriver)
driver.get("https://www.google.com")
Code to trigger the browser shortcut
ActionChains(driver).key_down(Keys.CONTROL).send_keys('j').key_up(Keys.CONTROL).perform()