Python - Selenium - How to use Browser Shortcuts

后端 未结 4 1158
遥遥无期
遥遥无期 2020-12-19 08:51

Once a browser page is loaded I\'m looking to use the CRTL+P shortcut in Goggle Chrome to enter the print page and then simply press return to print the page.



        
4条回答
  •  自闭症患者
    2020-12-19 09:30

    If i understood your question correctly my suggestion is that you install and use the pyautogui module to make your python program press keys

    For example:

    import pyautogui
    pyautogui.hotkey('ctrl','p')
    

    see the pyautogui documentation for more information: https://pyautogui.readthedocs.io/en/latest/introduction.html

提交回复
热议问题