def main(surname, email, time, link):
chrome_options = Options()
chrome_options.add_argument("--headless")
browser = webdriver.Chrome(options=chrome_options)
browser.maximize_window()
browser.get(link)
sleep(2)
browser.find_element(By.NAME, value='startQuiz').click()
sleep(2)
List_name, List_value = Right_Answer(browser)
browser.find_element(by=By.NAME, value='restartQuiz').click()
browser.find_element(by=By.NAME, value='startQuiz').click()
sleep(2)
test_execution(browser, List_name, List_value, time)
# await send_data(browser, email, surname)
browser.get_screenshot_as_file("Result.jpg")
browser.quit()
def db_start():
try:
global connection, cursor
connection = pymysql.connect(
host=host,
port=3306,
user=user,
password=password,
database=db_name,
cursorclass=pymysql.cursors.DictCursor
)
cursor = connection.cursor()
except Exception as ex:
print("Connection refused...")
print(ex)
async def record_participate(id, number):
connection.connect
sql = "UPDATE `user` SET `participate`=%s WHERE `id` = %s"
cursor.execute(sql, [number,id])
connection.commit()