├── .gitignore ├── _config.yml ├── LICENSE.md ├── README.md └── questionnaire_fillup.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman 2 | plugins: 3 | - jemoji 4 | title: Alfarabi Questionnaire Auto-Filler 🤖 5 | show_downloads: true 6 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [2019] [Kerollos Magdy] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
If you are lazy enough (just like me). This script will fill up the questionnaires for you :rocket:
6 | 7 | ## :package: Requirements 8 | 9 | - [python3, pip3](https://python.org) 10 | - [selenium](https://selenium-python.readthedocs.io/installation.html) 11 | - [Firefox](https://www.mozilla.org/en-US/firefox/new/) 12 | - [geckodriver](https://github.com/mozilla/geckodriver/releases) 13 |Check the wiki!
16 |42 | 43 |
44 | 45 | ## :page_facing_up: License 46 | 47 | [MIT](./LICENSE.md) license 48 | 49 |50 |
51 |53 | 54 | -------------------------------------------------------------------------------- /questionnaire_fillup.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | import os 3 | import time 4 | 5 | 6 | def save_and_submit(): 7 | driver.find_element_by_xpath( 8 | "//button[@class='btn btn-icon btn-primary glyphicons circle_ok center']").click() 9 | # save and submit 10 | 11 | 12 | USERNAME = os.environ['STUDENT_USERNAME'] 13 | PASSWORD = os.environ['STUDENT_PASSWORD'] 14 | 15 | driver = webdriver.Firefox() 16 | 17 | driver.get("https://alfarabi.mans.edu.eg/login") 18 | 19 | username_input = driver.find_element_by_xpath("//input[@name='username']") 20 | password_input = driver.find_element_by_xpath("//input[@name='password']") 21 | 22 | username_input.send_keys(USERNAME) 23 | password_input.send_keys(PASSWORD) 24 | driver.find_element_by_xpath( 25 | "//input[@name='userType'][@value='2']").click() # usertype = student 26 | driver.find_element_by_xpath( 27 | "//button[@class='btn btn-primary']").click() # signin button 28 | 29 | time.sleep(2) 30 | 31 | subjects = driver.find_elements_by_xpath("//li[@class='glyphicons dropMenu']") 32 | 33 | 34 | for subject in subjects: 35 | 36 | subject.click() 37 | time.sleep(1) 38 | 39 | driver.find_element_by_xpath( 40 | "//input[@class='uniform'][@type='checkbox']").click() # check on doctor name 41 | good_ratings = driver.find_elements_by_xpath( 42 | "//input[@type='radio'][@value='3']") 43 | 44 | for rating in good_ratings: 45 | rating.click() # check all "I totally agree" radio buttons 46 | 47 | strengths, weaknesses = driver.find_elements_by_xpath( 48 | "//input[@type='text']") 49 | strengths.send_keys("...") 50 | weaknesses.send_keys("...") 51 | 52 | save_and_submit() 53 | 54 | 55 | general_questionnaires = driver.find_elements_by_xpath( 56 | "//li[@class='glyphicons']") 57 | 58 | 59 | for g_q in general_questionnaires: 60 | 61 | g_q.click() 62 | time.sleep(1) 63 | 64 | good_ratings = driver.find_elements_by_xpath( 65 | "//input[@type='radio'][@value='2']") 66 | 67 | for rating in good_ratings: 68 | rating.click() 69 | 70 | save_and_submit() 71 | 72 | 73 | driver.close() 74 | --------------------------------------------------------------------------------MADE WITH :heart: @ SCU
52 |