pip install --upgrade pip
selenium提供键盘操作Keys类,但是其局限性太大。真正要模拟玩转键盘操作还是需要集成到PyUserInput里面的PyKeyboard这个库。
pip install PyUserInput -i https://pypi.douban.com/simple
根据您的平台,您还需要以下python模块才能运行PyUserInput:
Mac - Quartz,AppKitWindows - pyHook,pywin32
如果不安装为了实现跨平台的附加库则会报错: ImportError: cannot import name 'PyKeyboard'
如果不安装为了实现跨平台的附加库则会报错:
ImportError: cannot import name 'PyKeyboard'