A BOT to answer multiple choice quiz in moodle platform such as vclass.
- Internet connection to access vclass platform
- An answer document (.docx, .txt, or .pdf) in certain format to answer the quiz. Read Answer document format for more information.
- An URL to the quiz in vclass platform
The answer document should be in .docx, .txt, or .pdf.
There are two types of .docx document that are currently readable by the BOT, type 1 and type 2.
- Type 1 will scan for unique paragraph style uses by answer choices to determine the answer from the other answer choices.
- Type 2 will scan for string
"The correct answer is:"
occurrences to determine the answer.
Download format: answer_type1.docx or answer_type2.docx
A .txt document is currently the best and safest readable format for the BOT. The format should be a question, followed by the answer on the next line, and followed by blank line on the next line.
Download format: answer.txt
An exported pdf document from review page is preferable.
- The BOT will extract all text and images from the pdf document along with their coordinates.
- Extracted images are images of button (radio button) used to select the answer.
- If an image has more white pixels than specified threshold, it will be considered as an answer.
- A paragraph from extracted text will be deleted if it contains
"Question"
and"Mark"
because of these strings are not needed and could mess up with paragraph order. - The BOT will scan for string
"The correct answer is:"
occurrences to determine the answer if available. If not, continue to next step. - The BOT will scan for string
"Select one:"
occurrences to determine the question and answer choices. The question paragraph would be right before this string[i-1]
or right with it[i]
and the four of answer choices would be on the next two to five paragraphs[i+2:i+6]
. - The set of answer choices will be paired with the button images. The answer is determined by how many white pixel is in the button image.
Any differences in visual arrangement in a PDF document could cause the BOT to fail to do extraction process.
- Download latest version of VStudent here
- Extract
- Open and edit
config.ini
file using any text editor, enter your vclass username and password under login section.
Configration is done in config.ini
file.
Section | Key | Type | Description |
---|---|---|---|
login | username | str | your vclass username |
login | password | str | your vclass password |
vclass | login_confirmation | bool | ask for confirmation before login to vclass platform |
vclass | submit_quiz_confirmation | bool | ask for confirmation before submitting in last question page |
vclass | submit_summary_confirmation | bool | ask for confirmation before submitting in summary page |
vclass | answer_delay | int | delay in seconds before moving to the next question |
- Launch BOT executable file (vsg.exe)
- A file explorer will appear, select the answer document.
- Paste quiz URL. the URL should be looks like https://v-class.gunadarma.ac.id/mod/quiz/view.php?id=XXXXXX where XXXXXX is the quiz ID.
- A Firefox webdriver will be opened, and the BOT will attempt to login to vclass using given username and password in
config.ini
. - BOT will ask login confirmation if
login_confirmation
is set toTrue
inconfig.ini
file, otherwise it will automatically login. - BOT will go to the quiz page using the given URL and attempt or continue the quiz.
- After reaching last question, BOT will ask for confirmation before submitting in last question page if all question is successfully answered and
submit_quiz_confirmation
is set toTrue
inconfig.ini
file, otherwise it will automatically submit. - After submitting, BOT will ask for confirmation before submitting in summary page
submit_summary_confirmation
is set toTrue
inconfig.ini
file, otherwise it will automatically submit.
- Suppose there are two answers with similar words, e. g. a. IGPB and b. GPB, both contains GPB in their answer while answer in the answer document is GPB, any first option that contains GPB will be selected, thus the a. IGPB will be selected and answer is wrong. source.
- Failed to extract question and answer from type 2 document (.docx) because the paragraph is inside of textbox. source.
- Failed to extract question and answer from type 1 document (.txt) with UTF-8 encoding. Temporary workaround is to change the encoding to ANSI which can be done by opening the file in Notepad and save as new document with ANSI is selected as Encoding option.
- Failed to launch BOT executable file (vsg.exe) if mozila firefox has not been installed. This could be fixed by launching the driver executable inside
driver/
folder. - Any differences in visual arrangement in a PDF document could cause the BOT to fail to do extraction process.