search

Home  >  Q&A  >  body text

python - selenium环境搭建的问题

#-*- coding: UTF-8 -*-
from selenium import webdriver
import time


browser = webdriver.Chrome()
browser.get("http://cnblogs.com")
time.sleep(1)
browser.find_element_by_link_text("登录").click()
time.sleep(1)
browser.find_element_by_id("input1").send_keys("用户名")
browser.find_element_by_id("input2").send_keys("密码")
browser.find_element_by_id("signin").click()
time.sleep(1)
try:
    if browser.find_element_by_link_text("退出"):
        print "Login Successfully."
except:
    print "Login failed."

出现如上错误

已经使用sudo easy_install selenium安装了selenium

请问:

每一个接口调用的包,比如这里调用的是 chromedriver的包,是否每次都需要单独下载?
或者是有一次性安装包?
阿神阿神2766 days ago487

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-04-18 09:44:03

    Using selenium to operate chrome requires a driver. I have introduced it in my blog for your reference
    Python installation guide for selenium

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-18 09:44:03

    you should put the chromedriver.exe path in the system environment varible PATH, or use the path to initiate selenium driver in your py.

    reply
    0
  • Cancelreply