温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

使用selenium登录QQ空间

发布时间:2020-08-05 23:36:12 来源:网络 阅读:1815 作者:Forande 栏目:系统运维

使用selenium登录QQ空间

打开QQ空间
使用selenium登录QQ空间

-- coding: utf-8 --
File : 3.登录qq空间.py
Author: HuXianyong
Date : 2018-09-12 14:56

from selenium import webdriver
chrom = webdriver.Chrome()
url = 'https://qzone.qq.com/'
chrom.get(url)
#这里的意思是我们要选择账号登录之前先要选择到这个qq登录方式的白框里面来做选择,不然直接在页面里面没有账号登录的这个选项这样会报错的
chrom.switch_to.frame("login_frame")
#选择账号登录
chrom.find_element_by_id("switcher_plogin").click()

写入账号和密码然后登陆QQ空间
使用selenium登录QQ空间

- coding: utf-8 --
File : 3.登录qq空间.py
Author: HuXianyong
Date : 2018-09-12 14:56

from selenium import webdriver

chrom = webdriver.Chrome()
url = 'https://qzone.qq.com/'

chrom.get(url)

#这里的意思是我们要选择账号登录之前先要选择到这个qq登录方式的白框里面来做选择,不然直接在页面里面没有账号登录的这个选项这样会报错的
chrom.switch_to.frame("login_frame")
#选择账号登录
chrom.find_element_by_id("switcher_plogin").click()

#找到用户名对应的ID
username = chrom.find_element_by_id("u")
#给对应的密码的ID发送登录账号
username.send_keys("56273754")
#获取对应的密码的ID
passwd = chrom.find_element_by_id("p")
#给对应的密码的ID发送登录密码
passwd.send_keys("mgh****3")
chrom.find_element_by_id("login_button").click()

#退出浏览器窗口
chrom.quit()

登陆完成看些结果
使用selenium登录QQ空间

到此登陆完成

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI