1.把下载的浏览器驱动放在python目录下之后(前提python目录是环境变量path下的)
2.打开pycharm新建项目:
file--new project

3.新建python文件,右键工程新建:

4.工程下导入selenium
file--setting--project:WebAutoScript--project interpreter


5.编写脚本:
使用google chrome浏览器
from seleniumimport webdriver
driver=webdriver.Chrome()
driver.get('https://www.baidu.com')
driver.quit()
使用firefox浏览器:
from seleniumimport webdriver
driver=webdriver.Firefox()
driver.get('https://www.baidu.com')
driver.quit()
网友评论