美文网首页
一平台计算机绘图评分

一平台计算机绘图评分

作者: Noza_ea8f | 来源:发表于2024-05-20 10:11 被阅读0次
    from DrissionPage import ChromiumPage
    from lib import user_info
    import random
    import time
    
    
    def wait_key():
        while True:
            message = input('请输入“空格键”继续:')
            if message == ' ':
                break
            print('你输入的是 ' + message + '!')
    
    
    # 用 DrissionPage 模式创建页面对象(默认模式)
    page = ChromiumPage()
    
    # 跳转到登录页面
    url = 'https://iam.pt.ouchn.cn/am/UI/Login?realm=%2F&service=initService&goto=https%3A%2F%2Fiam.pt.ouchn.cn%2Fam%2Foauth2%2Fauthorize%3Fservice%3DinitService%26response_type%3Dcode%26client_id%3D345fcbaf076a4f8a%26scope%3Dall%26redirect_uri%3Dhttps%253A%252F%252Fmenhu.pt.ouchn.cn%252Fouchnapp%252Fwap%252Flogin%252Findex%26decision%3DAllow'
    
    page.get(url)
    # todo 登录
    # 定位到账号文本框并输入账号
    page.ele('#loginName').clear()
    page.ele('#loginName').input(user_info.username)
    # 定位到密码文本框并输入密码
    page.ele('#password').clear()
    page.ele('#password').input(user_info.password)
    wait_key()
    
    
    def start():
        page.wait.new_tab()  # 等待新tab打开也很爽
        page_x = page.get_tab(0)  # 取得新tab标签页
        time.sleep(5)
    
        try:
            # ele = page_x.ele('text:KB')
            ele = page_x.ele(
                'xpath://*[@id="give-score"]/div/div[2]/div[2]/div[1]/div[2]/div/div/div/div[2]/div/div[3]/span/a[3]/i')
            page_x.actions.move_to(ele).click()
            time.sleep(random.randint(10, 30))
            ele = page_x.ele('xpath://*[@id="give-score"]/div/div[2]/div[2]/div[2]/form/div/div[2]/div/input')
            page_x.actions.move_to(ele).click()
            ele.clear()
            ele.input(random.randint(97, 99))
            time.sleep(random.randint(30, 50))
            ele = page_x.ele('xpath://*[@id="give-score"]/div/div[2]/div[1]/div[2]/span[1]')
            page_x.actions.move_to(ele).click()
    
        except:
            try:
                # ele = page_x.ele('text:KB')
                ele = page_x.ele(
                    'xpath://*[@id="give-score"]/div/div[2]/div[2]/div[1]/div[2]/div/div/div/div[2]/div/div[3]/span/a[2]/i')
                page_x.actions.move_to(ele).click()
                time.sleep(random.randint(10, 30))
                ele = page_x.ele('xpath://*[@id="give-score"]/div/div[2]/div[2]/div[2]/form/div/div[2]/div/input')
                page_x.actions.move_to(ele).click()
                ele.clear()
                ele.input(random.randint(97, 99))
                time.sleep(random.randint(30, 50))
                ele = page_x.ele('xpath://*[@id="give-score"]/div/div[2]/div[1]/div[2]/span[1]')
                page_x.actions.move_to(ele).click()
            except:
                # ele = page_x.ele('text:KB')
                ele = page_x.ele(
                    'xpath://*[@id="give-score"]/div/div[2]/div[2]/div[1]/div[2]/div/div/div/div[2]/div/div[3]/span/a/i')
                page_x.actions.move_to(ele).click()
                time.sleep(random.randint(10, 30))
                ele = page_x.ele('xpath://*[@id="give-score"]/div/div[2]/div[2]/div[2]/form/div/div[2]/div/input')
                page_x.actions.move_to(ele).click()
                ele.clear()
                ele.input(random.randint(97, 99))
                time.sleep(random.randint(30, 50))
                ele = page_x.ele('xpath://*[@id="give-score"]/div/div[2]/div[1]/div[2]/span[1]')
                page_x.actions.move_to(ele).click()
    
    
    # start(user_info.username, user_info.password)
    
    while True:
        message = input('请输入“次数”继续:')
        if message == ' ':
            break
        for i in range(0, int(message)):
            start()
        print('你输入的是 ' + message + '!')
    

    相关文章

      网友评论

          本文标题:一平台计算机绘图评分

          本文链接:https://www.haomeiwen.com/subject/aqanfjtx.html