小破站漁場自動(dòng)摸魚

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) #這里設(shè)置的是等待多少秒,也就是瀏覽器等待你登錄
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'),  # 這里是固定的每個(gè)網(wǎng)站都不同
    #         '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)





?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容