from selenium import webdriver
from selenium.webdriver.common.by import By
import time
chrome_driver = r'C:\Users\P72\Desktop\chromedriver.exe' #chromedriver的文件位置
driver = webdriver.Chrome()
driver.get('https://live.bilibili.com/xxxxxx')
start=time.time()
time.sleep(25) #这里设置的是等待多少秒,也就是浏览器等待你登录
insertButton = driver.find_element(By.XPATH, '//*[@id="control-panel-ctnr-box"]/div[2]/div[2]/textarea')
sendButton = driver.find_element(By.XPATH, '//*[@id="control-panel-ctnr-box"]/div[3]/div/button/span')
try:
time.sleep(1)
insertButton.click()
time.sleep(1)
insertButton.send_keys('摸鱼')
sendButton.click()
while True:
insertButton.click()
insertButton.send_keys('摸')
sendButton.click()
time.sleep(60)
# break
# driver.refresh() #先刷新界面
# driver.delete_all_cookies()
# cookies=driver.get_cookies()
# print(cookies) #获得cookie并打印
# for cookie in cookies:
# cookie_dict = {
# 'domain': cookie.get('domain'), # 这里是固定的每个网站都不同
# 'name': cookie.get('name'),
# 'value': cookie.get('value'),
# "expires": cookie.get('expiry', 0),
# 'path': '/',
# 'httpOnly': cookie.get('httpOnly'),
# 'HostOnly': False,
# 'Secure': cookie.get('secure')
# }
# driver.add_cookie(cookie_dict)
# driver.refresh() #带着cookie重新加载
# time.sleep(5)
#
except Exception as e:
print(e)
小破站渔场自动摸鱼
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 从年前备受好评的跨年晚会,到前段时间刷爆朋友圈以及登上央视广告的《后浪》, B站真是一次又一次的大手笔! 第一,B...