#-*- 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的包,是否每次都需要单独下载?
或者是有一次性安装包?
Using selenium to operate chrome requires a driver. I have introduced it in my blog for your reference
Python installation guide for selenium
you should put the chromedriver.exe path in the system environment varible PATH, or use the path to initiate selenium driver in your py.