Selenium-百度登录简单例子

实现:

百度web端登录,手动输入验证码

#! /usr/bin/env python
#coding=utf-8

from selenium import webdriver
import time

driver = webdriver.Firefox()
driver.get("https://www.baidu.com/")
time.sleep(3)

driver.find_element("linkText","登录").click()
driver.find_element("name","userName").send_keys("xxxxx")
driver.find_element("name","password").send_keys("xxxx")
time.sleep(20)
#手动输入验证码
driver.find_element("id","TANGRAM__PSP_10__submit").click()
time.sleep(5)
driver.quit()

结果:

登录后:

posted @ 2017-09-03 03:04  R-Bear  阅读(2964)  评论(0编辑  收藏  举报