Python Selenium function keys aren't working (F5 or F12)


I am trying to get a selenium opened webpage to use function keys, however they don’t seem to do anything.
Current code is below:

from selenium import webdriver
from import By
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
import time

url = ''

driver = webdriver.Chrome()
actionChains = ActionChains(driver)


driver.find_element(By.XPATH, '/html/body/div[1]/div[3]/form/div[1]/div[1]/div[1]/div/div[2]/input').send_keys(Keys.F12)

There isn’t an error after running it. It’s just that nothing happens.
Am I perhaps missing something? I am very confused.

Any assistance would be appreciated.


I think this problem hasn’t been solved yet.
but there are some suggested solutions to go around this,
Check this post:
Pressing "F12" key directly through Selenium

Answered By – Kassab

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published