当前位置:   article > 正文

50行代码的微信公众号抢号脚本_微信小程序抢票脚本

微信小程序抢票脚本
import re
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
import time
import random
from tkinter import messagebox, Tk


def PolledDoctor(url, browser, interval):
    while(1):
        browser.get(url)
        browser.implicitly_wait(10)
        names = browser.find_elements(By.CSS_SELECTOR, '.doctorname')
        status = browser.find_elements(By.CSS_SELECTOR, '.doctoryuyue.flex.flex-align-center.flex-pack-center')
        for i in range(len(names)):
            if names[i].text == 'xxx':
                index = i
                break
        names[i].click()
        browser.implicitly_wait(10)
        windows = browser.window_handles
        browser.switch_to.window(windows[-1])
        try:
            knowing = browser.find_element(By.CSS_SELECTOR, '.knowimg')
            knowing.click()
            windows = browser.window_handles
            browser.switch_to.window(windows[-1])
        except:
            print("No knowing blcok")
        order_status_list = browser.find_elements(By.CSS_SELECTOR, '.yuyue.fr.doctoryuyue')
        for i in range(len(order_status_list)):
            order_text = order_status_list[i].get_attribute('innerText')
            if order_text == '':
                print('Order Text Wrong!')
            elif order_text != '约满' and order_text != '未开':
                window = Tk()
                window.attributes("-topmost", 1)
                window.withdraw()
                messagebox.showinfo('提示', '开始约号儿啦!')
        time.sleep(interval)

if __name__ == '__main__':
    option = webdriver.ChromeOptions()
    # option.add_argument('headless')  # 设置option
    s = Service("D:\\SW_PACKAGE\\chromedriver_win32\\chromedriver.exe")
    browser = webdriver.Chrome(service=s, options=option)
    url = "https://www.baidu.com/"  # 用自己的url替代
    interval = random.randint(10, 20) 
    # interval = 5
    PolledDoctor(url, browser, interval)
    browser.quit()
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/307036
推荐阅读
相关标签
  

闽ICP备14008679号