def bitalk_log(username,password):
# 请求登录页面
try:
drive = webdriver.Chrome()
url = 'https://steemconnect.com/oauth2/authorize?client_id=duozhuan&redirect_uri=https%3A%2F%2Fwww.bitalk.cc%2Fcallback%2F&scope='
drive.get(url)
# 睡眠2秒
time.sleep(2)
# 找到continue按钮点击进去
drive.find_element_by_xpath("//button").click()
# 休眠0.5秒钟后执行填写用户名和密码操作
time.sleep(0.5)
# 找到用户名输入用户名
user = drive.find_element_by_id("username")
user.send_keys(username)
# 找到密码输入密码
drive.find_element_by_id("password").send_keys(password)
# 点击登录按钮实现登录
drive.find_element_by_xpath("//button").click()
# 登录成功后跳转首页,进行加载,休眠10秒加载页面
time.sleep(20)
# 点击进入发帖页面
return drive
except Exception as e:
print("出现问题",e)
# 实现发帖
def fatie(drive,json):
# 获取内容
title1 = drive.find_element_by_xpath("//div[@class='StoryFull']/h1[@class='StoryFull__title']").text
网友评论