2011-11-03 56 views

回答

3

對於python,您必須從http://code.google.com/p/chromium/downloads/list下載chrome驅動程序。解壓縮zip文件並在Path環境變量中設置chrome驅動程序路徑。請參閱下面的示例使用Python -

from selenium import webdriver 

from selenium.webdriver.common.keys import Keys 

driver = webdriver.Chrome() 

driver.get("http://www.google.com") 

elem = driver.find_element_by_name("q") 

elem.send_keys("selenium") 

elem.send_keys(Keys.RETURN) 

assert "Google" in driver.title 

driver.quit() 
相關問題