如何安装硒 [英] how to install selenium

查看:95
本文介绍了如何安装硒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用python 3.5.2,当我尝试导入硒时会抛出错误

I am using python 3.5.2, when am tryng to import the selenium it is throwing an error

没有名为硒的模块

No module named selenium

下面是我的代码:

from selenium import webdriver

推荐答案

步骤1:为Selenium安装Python绑定

Step 1: Install Python bindings for Selenium

pip install selenium

第2步:安装浏览器驱动程序

Step 2: Install the browser drivers

Selenium需要驱动程序才能与所选浏览器交互.

Selenium requires a driver to interface with the chosen browser.

Firefox需要安装 geckodriver .

Firefox, for example, requires geckodriver, which needs to be installed.

  1. 此处获取可执行文件(只需从最新版本中下载一个)
  2. >
  3. 将可执行文件移至您的PATH ,例如G. ubuntu,将其放在/usr/bin/usr/local/bin中.
  1. Get the executable from here (just download one from the last release)
  2. Move the executable to your PATH, e. g. ubuntu, place it in /usr/bin or /usr/local/bin.

注意:其他受支持的浏览器将具有其自己的驱动程序,此处有更多信息

Note: Other supported browsers will have their own drivers available more info here

这篇关于如何安装硒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆