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()


  

原文地址:https://www.cnblogs.com/zhouwp/p/8421391.html