python+Visual studio code配置Selenium环境

发布时间:2019-06-16 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了python+Visual studio code配置Selenium环境脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

python+Visual studio code配置Selenium环境

使用pip命令安装selenium

Visual studio code控制台中直接输入:

python -m pip install selenium

clipboard.png

  • 查看是否安装selenium成功

Visual studio code中直接输入:

pip show selenium

clipboard.png

https://sites.google.com/a/ch...
https://github.com/mozilla/ge...

将chromedriver.exe、geckodriver.exe放在python安装目录,或将chromedriver.exe所在目录添加到环境变量path中

  • 检查Selenium+python+Visual studio code是否配置成功
# coding:utf-8
From selenium import webdriver
# 创建Firefox对象
# driver = webdriver.Firefox()
driver = webdriver.Chrome()
driver.get('https://cn.bing.COM/')
driver.quIT()

F5运行代码,打开https://cn.bing.com/,配置成功

版本

  • python版本3.6.4

    PS D:Pythonselenium> python
       Python 3@H_126_114@.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
       Type "help", "copyright", "credits" or "license" for more information.
    
  • Selenium版本3.141.0

       PS D:Pythonselenium> pip show selenium
       Name: selenium
       Version: 3.141.0
       Summary: Python bindings for Selenium
       Home-page: https://github.com/SeleniumHQ/selenium/
       Author: UNKNOWN
       Author-email: UNKNOWN
       License: Apache 2.0
       Location: c:programspythonpython36-32libsite-packages
       Requires: urllib3
       Required-by:  
    
  • Chrome版本 70.0.3538.77(正式版本) (64 位)
  • ChromeDriver版本2.43

脚本宝典总结

以上是脚本宝典为你收集整理的python+Visual studio code配置Selenium环境全部内容,希望文章能够帮你解决python+Visual studio code配置Selenium环境所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。