url:https://qzone.qq.com/

哀求:用账号密码上岸QQ空间,未做无头处理。

要求库:selenium

qq空间登陆html模板应用selenium模仿登录QQ空间 Angular

写法:常规

难度:入门

from selenium import webdriverfrom time import sleepbro = webdriver.Chrome('./chromedriver/chromedriver.exe')bro.get('https://qzone.qq.com/')# 切换账号密码登录# 1.切换iframe标签bro.switch_to_frame('login_frame')# 2.定位标签ch = bro.find_element_by_id('switcher_plogin')# 3.点击按键ch.click()# 定位QQ号和密码标签name_input = bro.find_element_by_id('u')pwd_input = bro.find_element_by_id('p')name_input.send_keys('QQ号')pwd_input.send_keys('密码')# 定位登录按键btn = bro.find_element_by_id('login_button')btn.click()sleep(10)bro.quit()