[SOLVED] how to press F12 with selenium python

Leo_nard

Prominent
Jan 6, 2020
5
0
510
hello everyone, I would need a hand to simulate the "F12" key with selenium webdriver. Generally I need a way to open and close the source code of the html page I'm scraping on, but I can't find anything on the internet. Anyone know? Could you help me pls?
 
Solution
I googled a bit and found the following links:

https://stackoverflow.com/questions...hon-without-raising-lowlevelkeyhookinjected-0

https://www.codegrepper.com/code-examples/python/simulate+key+press+python

https://www.semicolonworld.com/question/43959/python-simulate-keydown

The third link (near the end) provides a listing of keycodes:

For example

VK_F12 = 0x7B # F12 key

Not sure about the details of what you are doing nor the requirements and/or limitations being imposed.

However if you google "Python simulate F12 keypress" you will find many possible ways to simulate keypresses.

Read and revise the search criteria as necessary to find a code...

Ralston18

Titan
Moderator
I googled a bit and found the following links:

https://stackoverflow.com/questions...hon-without-raising-lowlevelkeyhookinjected-0

https://www.codegrepper.com/code-examples/python/simulate+key+press+python

https://www.semicolonworld.com/question/43959/python-simulate-keydown

The third link (near the end) provides a listing of keycodes:

For example

VK_F12 = 0x7B # F12 key

Not sure about the details of what you are doing nor the requirements and/or limitations being imposed.

However if you google "Python simulate F12 keypress" you will find many possible ways to simulate keypresses.

Read and revise the search criteria as necessary to find a code snippet(s) that directly or indirectly meets your requirements.

Edit and revise the code snippet as needed.
 
Solution