DrissionPage icon indicating copy to clipboard operation
DrissionPage copied to clipboard

I want my code to use drissionpage library rather than uc

Open vndhote opened this issue 1 year ago • 0 comments

I want my code to use drissionpage library rather than uc so if anyone can help me change the commandlines in my code from uc to that of drissionpage would help me a lot ....

    clear_console()
    print(mainbann)
    print(vivekop)
    driver.delete_cookie('connect.sid')
    driver.add_cookie(cookie)
    print("[+] Added Cookie To The Website")
    driver.refresh()
    print("[+] Successfully Logged To Top.gg")
    time.sleep(2)

    max_attempts = 3  # Maximum number of voting attempts
    max_total_attempts = 3  # Maximum number of total voting process attempts

    for total_attempt in range(1, max_total_attempts + 1):
        print(f"[+] Voting Attempt {total_attempt}/{max_total_attempts}")
        
        for vote_attempt in range(1, max_attempts + 1):
            try:
                voteBtn = WebDriverWait(driver, 7).until(EC.element_to_be_clickable((By.XPATH, ".//button[contains(text(),'Vote')]")))
                print("[+] Found Clickable Vote Button")
                time.sleep(1)

                action_chain = ActionChains(driver)
                action_chain.move_to_element(voteBtn)
                action_chain.click(voteBtn)
                action_chain.perform()
                print("[+] Successfully Clicked The Vote Button")
                time.sleep(1)

                try:
                    WebDriverWait(driver, 8, ignored_exceptions=(TimeoutException,)).until(EC.element_to_be_clickable((By.XPATH, ".//button[contains(text(),'Remind me')]")))
                    print("[+] Thanks For Voting Message Appeared")
                    print("[+] Successfully Voted The Stupid Bot !!")
                    send_discord_message(cookie.get('username'), success=True)
                    return
                except:
                    print("[-] Thanks For Voting message didn't appear after clicking the vote button.")
                    print("[-] Waiting for 35 seconds for captcha solving.")
                    time.sleep(6)

                try:
                    WebDriverWait(driver, 26).until(EC.element_to_be_clickable((By.XPATH, ".//button[contains(text(),'Remind me')]")))
                    print("[+] Thanks For Voting Message Appeared")
                    print("[+] Successfully Voted The Stupid Bot !!")
                    send_discord_message(cookie.get('username'), success=True)
                    return
                except:
                    print("[-] Failed to vote the stupid bot.")
                    send_discord_message(cookie.get('username'), success=False)
                    time.sleep(1)

            except:
                print("[-] Failed to find the vote button.")
                if vote_attempt < max_attempts:
                    print(f"[-] Retrying voting attempt {vote_attempt + 1}/{max_attempts}...")
                    driver.refresh()
                    time.sleep(4)

        # If all attempts fail for this voting process, wait for 35 seconds and retry the whole process
        print("[-] Voting process failed. Waiting for 35 seconds and retrying...")
        time.sleep(35)

    # If all attempts fail for all voting processes, print a final failure message and send Discord message
    print("[-] Failed to vote the stupid bot after multiple attempts.")
    send_discord_message(cookie.get('username'), success=False)```

vndhote avatar Aug 16 '23 15:08 vndhote