引用下面两个包

from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains

键盘组合ctrl+c,ctrl+x等

ActionChains(self.driver).key_down(Keys.CONTROL).send_keys('c').key_up(Keys.CONTROL).perform()
ActionChains(self.driver).key_down(Keys.CONTROL).send_keys('x').key_up(Keys.CONTROL).perform()

单个按键

ActionChains(self.driver).key_down(Keys.ENTER).perform()
ActionChains(self.driver).key_down(Keys.DELETE).perform()