美文网首页
selenium如何启动google chrome/firefo

selenium如何启动google chrome/firefo

作者: 偶然路过的靓仔_胡阳 | 来源:发表于2019-08-12 16:28 被阅读0次

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()

相关文章

网友评论

      本文标题:selenium如何启动google chrome/firefo

      本文链接:https://www.haomeiwen.com/subject/ipvujctx.html