1.下载并安装jdk,配置环境变量;
2.下载并安装python,配置path系统环境变量:D:Program Filespython34;
3.安装selenium,在安装好的python路径D:Program Filespython34Scripts下执行pip install -U selenium
4.下载eclipse,在eclipse中在线安装pyDev:Help—Install New Software..—Add,输入http://pydev.org/updates
5.pydev安装后,eclipse中配置python解释器:Window > Preferences > Pydev > Interpreter - Python。单击New,选择已安装的python.exe
6.Eclipse中,选择 File > New > Project > Pydev > Pydev Project;
7.工程创建后,创建py文件:
#-*- conding=utf-8 -*-
from selenium import webdriver
if __name__ == "__main__":
driver = webdriver.Firefox()
driver.implicitly_wait(30)
driver.get("http://www.baidu.com")
driver.find_element_by_id("kw").send_keys("Selenium")
driver.find_element_by_id("su").submit()
driver.quit()
运行。