1.模拟登录QQ空间
from selenium import webdriver
from time import sleep
from selenium.webdriver import ActionChains
#获取服务器对象
driver = webdriver.Chrome('./chromedriver.exe')
#发送url请求
driver.get('https://qzone.qq.com/')
#定位变迁
driver.switch_to.frame('login_frame')
btn = driver.find_element_by_id('switcher_plogin')
btn.click()
sleep(2)
#登录模拟
username = driver.find_element_by_id('u')
password = driver.find_element_by_id('p')
sleep(1)
username.send_keys('1111111')
sleep(1)
password.send_keys('11111111111')
sleep(1)
btn1 = driver.find_element_by_id('login_button')
btn1.click()
sleep(5)
driver.quit()