【Python爬虫】:模拟登录QQ空间


观察了下QQ空间实在是太好登录了!只需要首先点击账号密码登录,然后输入你的账号和密码就可以了!

 

 

 

其中需要注意的是;

1.进行第一次点击的时候,点击“账号密码”的时候,需要首先切换到iframe模式

2.根据id进行选择输入

代码如下;

from selenium import webdriver
import time
from lxml import etree
from selenium.webdriver.common.action_chains import ActionChains

bro=webdriver.Chrome(executable_path='./driver.exe')
bro.get('https://qzone.qq.com/')

bro.switch_to.frame('login_frame')
a_tag=bro.find_element_by_id('switcher_plogin')
a_tag.click()

username=bro.find_element_by_id('u')
passwd=bro.find_element_by_id('p')

username.send_keys("123456789")
passwd.send_keys("huhuhuhuhuh")

time.sleep(3)

button=bro.find_element_by_id('login_button')
button.click()
#bro.quit()

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM