|
| 1 | +from selenium import webdriver |
| 2 | +from selenium.webdriver.common.keys import Keys |
| 3 | +from time import sleep |
| 4 | +from webdriver_manager.chrome import ChromeDriverManager |
| 5 | +from selenium.webdriver.common.by import By |
| 6 | + |
| 7 | + |
| 8 | +user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36" |
| 9 | + |
| 10 | +options = webdriver.ChromeOptions() |
| 11 | +options.headless = False |
| 12 | +options.add_argument(f'user-agent={user_agent}') |
| 13 | +options.add_argument("--window-size=1920,1080") |
| 14 | +options.add_argument('--ignore-certificate-errors') |
| 15 | +options.add_argument('--allow-running-insecure-content') |
| 16 | +options.add_argument("--disable-extensions") |
| 17 | +options.add_argument("--proxy-server='direct://'") |
| 18 | +options.add_argument("--proxy-bypass-list=*") |
| 19 | +options.add_argument("--start-maximized") |
| 20 | +options.add_argument('--disable-gpu') |
| 21 | +options.add_argument('--disable-dev-shm-usage') |
| 22 | +options.add_argument('--no-sandbox') |
| 23 | + |
| 24 | + |
| 25 | +YourName = input("Enter Your Name: ") |
| 26 | +link = input("Enter Link: ") |
| 27 | + |
| 28 | +total_question = 15 |
| 29 | + |
| 30 | +driver = webdriver.Chrome(ChromeDriverManager().install() , options=options) |
| 31 | +driver.get(link) |
| 32 | + |
| 33 | +print("------Opening Link-------") |
| 34 | + |
| 35 | +sleep(2) |
| 36 | + |
| 37 | +print("-----Entering Your Name------") |
| 38 | + |
| 39 | +driver.find_element(By.ID,"name").send_keys(YourName) |
| 40 | +driver.find_element(By.ID,"name").send_keys(Keys.RETURN) |
| 41 | + |
| 42 | +print("------Loading---------") |
| 43 | + |
| 44 | +sleep(2) |
| 45 | + |
| 46 | +print("------Loaded------ \n") |
| 47 | + |
| 48 | +for i in range(0,total_question): |
| 49 | + try: |
| 50 | + unanswerd_question = driver.find_element(By.CLASS_NAME,"question.unanswered") |
| 51 | + correct_answer = unanswerd_question.find_element(By.CLASS_NAME,"answer.correct").click() |
| 52 | + print(str(i + 1) + ") Question Done") |
| 53 | + sleep(1.5) |
| 54 | + except: |
| 55 | + print("Answer Not Found!") |
| 56 | +sleep(2) |
| 57 | +driver.close() |
| 58 | +print("Submitted!") |
| 59 | + |
| 60 | + |
0 commit comments