模拟登陆QQ空间
from selenium import webdriver
from time import sleep
#实例化一个浏览器对象(传入浏览器的驱动成)
bro=webdriver.Chrome(executable_path='./chromedriver')
#让浏览器发起一个指定url对应请求
bro.get('https://qzone.qq.com/')
#定位iframe
bro.switch_to.frame('login_frame')
#标签定位
a_tag=bro.find_element_by_id('switcher_plogin')
#点击标签
a_tag.click()
userName_tag=bro.find_element_by_id('u') #id值
password_tag =bro.find_element_by_id('p')
sleep(1)
userName_tag.send_keys('923006708')
password_tag.send_keys('520201314xiao')
btn=bro.find_element_by_id('login_button')
btn.click()
sleep(5)
bro.quit()