python 에서 selenium 에서 자주 사용 하 는 키보드 키

python 에서 selenium 에서 자주 사용 하 는 키보드 키 
#!/usr/bin/python
# -*- coding: utf-8 -*- 
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

driver = webdriver.Chrome()
driver.get("http://www.baidu.com")
time.sleep(3)

driver.find_element_by_id('kw').send_keys('selenium') #       "selenium" 
driver.find_element_by_id('kw').send_keys(Keys.SPACE) #     
driver.find_element_by_id('kw').send_keys('python') #       "python"
driver.find_element_by_id('kw').send_keys(Keys.CONTROL, 'a') #  Control+a    
driver.find_element_by_id('kw').send_keys(Keys.CONTROL, 'c') #  Control+c    
driver.find_element_by_id('kw').send_keys(Keys.CONTROL, 'v') #  Control+v    
driver.find_element_by_id('kw').send_keys(Keys.ENTER) #            
 
time.sleep(3)
driver.close()

#            :
 # Keys.BACK_SPACE:   (BackSpace)
 # Keys.TAB:   (Tab)
 # Keys.ENTER:   (Enter)
 # Keys.SHIFT:      (Shift)
 # Keys.CONTROL:Control (Ctrl) 
 # Keys.ALT:ALT (Alt) 
 # Keys.ESCAPE:   (Esc) 
 # Keys.SPACE:   (Space) 
 # Keys.PAGE_UP:    (Page Up) 
 # Keys.PAGE_DOWN:    (Page Down) 
 # Keys.END:   (End) 
 # Keys.HOME:   (Home) 
 # Keys.LEFT:    (Left) 
 # Keys.UP:    (Up)
 # Keys.RIGHT:    (Right)
 # Keys.DOWN:    (Down) 
 # Keys.INSERT:   (Insert)
 # DELETE:   (Delete)
 # NUMPAD0 ~ NUMPAD9:   1-9 
 # F1 ~ F12:F1 - F12 
 # (Keys.CONTROL, ‘a’):   Control+a,   
 # (Keys.CONTROL, ‘c’):   Control+c,  
 # (Keys.CONTROL, ‘x’):   Control+x,   
 # (Keys.CONTROL, ‘v’):   Control+v,  

좋은 웹페이지 즐겨찾기