Loading

python+selenium+webdriver+BeautifulSoup实现自动登录

from selenium import webdriver
import time
from bs4 import BeautifulSoup
from urllib import request
import urllib

url = "http://www.hsbkos.com/"
re = urllib.request.urlopen(url)
response = (re)
content = response.read()
soup = BeautifulSoup(content, 'lxml')
# soup = BeautifulSoup()
soup.findAll('div',{'class':'objbox'})
driver = webdriver.Chrome()
time.sleep(1)
driver.get(url)
time.sleep(1)
driver.maximize_window()
loginButton = driver.find_element_by_id('loginin').click()

memberUsername = driver.find_element_by_name('memberUsername')
userPwd = driver.find_element_by_name('userPwd')
submitButton = driver.find_element_by_tag_name("strong")

memberUsername.send_keys('17364550000')
userPwd.send_keys('******')
time.sleep(1)
submitButton.click()
time.sleep(1)
# driver.close()


  

posted @ 2018-02-06 11:17  江雪独钓翁  阅读(1226)  评论(0编辑  收藏  举报