Update 2.5: Replaced some ID names

SeleniumIbrahimUpdate-Ibrahim
Ibrahim 2021-12-03 10:58:07 +08:00
parent 93a7661103
commit cf11ed40ad
8 changed files with 59 additions and 59 deletions

View File

@ -66,7 +66,7 @@ if ($_SESSION['user_type'] != "Lecturer") {
<div id="home" class="container tab-pane active"><br> <div id="home" class="container tab-pane active"><br>
<b>Create Lecturer/TA Accounts </b> <b>Create Lecturer/TA Accounts </b>
<form method="post" action="Script.php" id="create_acc_frm"> <form method="post" action="Script.php" id="create_account_form">
<input type="hidden" name="frm_createlecturrer" value="true" required="" /> <input type="hidden" name="frm_createlecturrer" value="true" required="" />
Full_Name Full_Name
<input type="text" name="fullname" placeholder="Full Name" class="form-control" required=""> <input type="text" name="fullname" placeholder="Full Name" class="form-control" required="">
@ -76,8 +76,8 @@ if ($_SESSION['user_type'] != "Lecturer") {
Passport_Number / ID (Used as Intial Password) Passport_Number / ID (Used as Intial Password)
<input type="text" class="form-control" name="passport" placeholder="Passport No./ID" required=""> <input type="text" class="form-control" name="passport" placeholder="Passport No./ID" required="">
<br> User Type : <br> User Type :
<input type="radio" name="type" value="Lecturer" required="" id="rad_lec"> Lecturer <input type="radio" name="type" value="Lecturer" required="" id="role_lecturer"> Lecturer
<input type="radio" name="type" value="TA" required="" id="rad_ta"> T/A <input type="radio" name="type" value="TA" required="" id="role_TA"> T/A
<input type="submit" class="btn btn-primary" value="Create" id="create_btn"><br> <input type="submit" class="btn btn-primary" value="Create" id="create_btn"><br>
<?php <?php
@ -121,10 +121,10 @@ if ($_SESSION['user_type'] != "Lecturer") {
$btn = "<button class='btn-primary' onclick=\"updatePass(" . $row['User_ID'] . ",'$pass')\">Reset</button>"; $btn = "<button class='btn-primary' onclick=\"updatePass(" . $row['User_ID'] . ",'$pass')\">Reset</button>";
if ($row['Status'] == "Active") { if ($row['Status'] == "Active") {
$newstatus = "Blocked"; $newstatus = "Blocked";
$btnBlock = "<button class='btn-danger' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"block_acc_1\">Block</button>"; $btnBlock = "<button class='btn-danger' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"block_account_1\">Block</button>";
} else { } else {
$newstatus = "Active"; $newstatus = "Active";
$btnBlock = "<button class='btn-success' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"activate_acc_1\">Activate</button>"; $btnBlock = "<button class='btn-success' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"activate_account_1\">Activate</button>";
} }
echo "<tr><td>" . $row['User_ID'] . "</td><td>" . $row['Full_Name'] . "</td><td>" . $row['Email'] . "</td> <td>" . $row['Passport_Number'] . "</td><td>$btn</td><td>$btnBlock</td></tr>"; echo "<tr><td>" . $row['User_ID'] . "</td><td>" . $row['Full_Name'] . "</td><td>" . $row['Email'] . "</td> <td>" . $row['Passport_Number'] . "</td><td>$btn</td><td>$btnBlock</td></tr>";
@ -138,11 +138,11 @@ if ($_SESSION['user_type'] != "Lecturer") {
<div id="menu2" class="container tab-pane fade" style="margin-top:10px"> <div id="menu2" class="container tab-pane fade" style="margin-top:10px">
<b>Separate two student numbers with a space.</b><br> <b>Separate two student numbers with a space.</b><br>
<form action="batch_insert.php" method="post" id="batch_frm"> <form action="batch_insert.php" method="post" id="batch_form">
<p> <p>
<textarea cols="80" rows="16" name="users" required=""></textarea> <textarea cols="80" rows="16" name="users" required=""></textarea>
</p> </p>
<input type="submit" class="btn btn-primary" value="Register Students" id="reg_btn"><br> <input type="submit" class="btn btn-primary" value="Register Students" id="register_btn"><br>
</form> </form>
</div> </div>

View File

@ -190,7 +190,7 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
<h3> Post new Lab Assignment </a></h3> <h3> Post new Lab Assignment </a></h3>
<form method='post' enctype='multipart/form-data' action='Script.php' id="newlab_frm"> <form method='post' enctype='multipart/form-data' action='Script.php' id="newlab_form">
<?php <?php
$_SESSION['url'] = $url; $_SESSION['url'] = $url;
?> ?>
@ -207,7 +207,7 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
Title Title
<input type='text' name='title' placeholder='Ttle' class='form-control' required='' value="" id="lab_title"> <input type='text' name='title' placeholder='Ttle' class='form-control' required='' value="" id="lab_title">
Instructions Instructions
<textarea name='instructions' placeholder='Assignment Instructions' class='form-control' required='' value="" id="lab_inst"></textarea> <textarea name='instructions' placeholder='Assignment Instructions' class='form-control' required='' value="" id="lab_instructor"></textarea>
Marks Marks
<input type='text' name='marks' placeholder='Marks' class='form-control' required='' value="" id="lab_mark"> <input type='text' name='marks' placeholder='Marks' class='form-control' required='' value="" id="lab_mark">
Attachment 1 Attachment 1
@ -222,9 +222,9 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
Attachment 4 Attachment 4
<input type='file' name='attachment4' placeholder='Attachment 4' class='form-control'> <input type='file' name='attachment4' placeholder='Attachment 4' class='form-control'>
<br> <br>
Submission Type <input type='radio' name='type' value='Individual' required='' id="lab_ind"> Individual Submission Type <input type='radio' name='type' value='Individual' required='' id="lab_individual"> Individual
<input type='radio' name='type' value='Group' required='' id="lab_grp"> Group <input type='radio' name='type' value='Group' required='' id="lab_group"> Group
<hr> <hr>
<input type='submit' class='btn btn-primary' value='Post Lab Assignment' id="submit_btn"><br> <input type='submit' class='btn btn-primary' value='Post Lab Assignment' id="submit_btn"><br>
</form><br><br><br><br> </form><br><br><br><br>
@ -431,25 +431,25 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'"
<input type="hidden" name="frm_createCourse" value="true" required="" /> <input type="hidden" name="frm_createCourse" value="true" required="" />
<input type="hidden" name="l" value="l" required="" /> <input type="hidden" name="l" value="l" required="" />
Course Name Course Name
<input type="text" name="name" placeholder="Course Name" class="form-control" required="" id="cname"> <input type="text" name="name" placeholder="Course Name" class="form-control" required="" id="course_name">
Course Code Course Code
<input type="text" name="code" placeholder="Course Code" class="form-control" required="" id="ccode"> <input type="text" name="code" placeholder="Course Code" class="form-control" required="" id="course_code">
URL (Leave blank to use Course Code & Year) URL (Leave blank to use Course Code & Year)
<input type="text" name="url" placeholder="Choose Custom URL " class="form-control"> <input type="text" name="url" placeholder="Choose Custom URL " class="form-control">
Academic Year Academic Year
<input type="text" name="academic" placeholder="Academic Year" class="form-control" required="" id="ayear"> <input type="text" name="academic" placeholder="Academic Year" class="form-control" required="" id="academic_year">
Faculty <br> Faculty <br>
<input type="text" name="faculty" placeholder="Faculty" class="form-control" required="" id="fac"> <input type="text" name="faculty" placeholder="Faculty" class="form-control" required="" id="faculty">
<input type="hidden" name="lecturer" value="<?php echo $_SESSION['user_id']; ?>"> <input type="hidden" name="lecturer" value="<?php echo $_SESSION['user_id']; ?>">
Verify Joining Students Verify Joining Students
<input type="radio" name="verify" value="1" id="jyes"> Yes <input type="radio" name="verify" value="1" id="join_yes"> Yes
<input type="radio" name="verify" value="0" checked="" id="jno"> No <input type="radio" name="verify" value="0" checked="" id="join_no"> No
<br> <br>
<input type="submit" class="btn btn-primary" value="Create Portal" id="portal_btn"><br> <input type="submit" class="btn btn-primary" value="Create Portal" id="portal_btn"><br>

View File

@ -64,7 +64,7 @@ if (mysqli_connect_errno()) {
<?php <?php
if ($_SESSION['user_type'] == "Lecturer") { if ($_SESSION['user_type'] == "Lecturer") {
echo "&nbsp;&nbsp;&nbsp; <i class=\"fa fa-cog\" style=\"color:#fff;\"> </i> &nbsp;<a style='color:#fff !important' href=\"~\..\Admin.php\" id=\"admin_btn\">Admin </a>"; echo "&nbsp;&nbsp;&nbsp; <i class=\"fa fa-cog\" style=\"color:#fff;\"> </i> &nbsp;<a style='color:#fff !important' href=\"~\..\Admin.php\" id=\"admin_tab\">Admin </a>";
} }
?> ?>

View File

@ -33,18 +33,18 @@ if (isset($_SESSION["user_fullname"])) {
<form method="post" action="Script.php" name="frm_login"> <form method="post" action="Script.php" name="frm_login">
<input type="hidden" name="frm_login" value="true"/> <input type="hidden" name="frm_login" value="true"/>
Student ID / Instructor Email Student ID / Instructor Email
<input type="text" name="user" placeholder="Email / Student Number" class="form-control" required="required" id="uname" /> <input type="text" name="user" placeholder="Email / Student Number" class="form-control" required="required" id="user_name" />
<br> <br>
Password Password
<input type="password" class="form-control" name="password" placeholder="password" required="required" id="upass" /> <input type="password" class="form-control" name="password" placeholder="password" required="required" id="user_password" />
<div class="text-center"> <div class="text-center">
<br><input type="submit" class="btn-primary" value="Login" id="log_btn"> <br><input type="submit" class="btn-primary" value="Login" id="login_btn">
</div> </div>
<br> <a href="recover_password.php" style="font-weight:normal;color:#2471A3; font-family: Poppins-Regular; <br> <a href="recover_password.php" style="font-weight:normal;color:#2471A3; font-family: Poppins-Regular;
font-size: 17px;">Reset my password</a> font-size: 17px;">Reset my password</a>
<div class="text-center"> <div class="text-center">
<br><span class="txt1">Don't have an account?</span> <br><span class="txt1">Don't have an account?</span>
<a class="txt2" href="signup.php" style="font-weight:normal" id="signup_btn">Sign Up</a> <a class="txt2" href="signup.php" style="font-weight:normal" id="signup_link">Sign Up</a>
</a> </a>
</div> </div>

View File

@ -17,24 +17,24 @@ include 'Header.php';
<div class="panel-body"> <div class="panel-body">
<form method="post" action="Script.php" id="signup_frm"> <form method="post" action="Script.php" id="signup_form">
<input type="hidden" name="frm_signup_2" value="true" /> <input type="hidden" name="frm_signup_2" value="true" />
Full Name Full Name
<input type="text" name="fullname" placeholder="Your full name" class="form-control" value="<?php echo $_SESSION['user_fullname']; ?>" required="required" id="funame"/> <input type="text" name="fullname" placeholder="Your full name" class="form-control" value="<?php echo $_SESSION['user_fullname']; ?>" required="required" id="full_name"/>
Student ID Student ID
<input type="text" name="user_student_id" placeholder="Entre your student ID" class="form-control" value="<?php echo $_SESSION['user_student_id']; ?>" required="required" id="std_id"> <input type="text" name="user_student_id" placeholder="Entre your student ID" class="form-control" value="<?php echo $_SESSION['user_student_id']; ?>" required="required" id="student_id">
Email Email
<input type="text" name="email" placeholder="Email" class="form-control" value="<?php echo $_SESSION['user_email']; ?>" required="required" id="email" /> <input type="text" name="email" placeholder="Email" class="form-control" value="<?php echo $_SESSION['user_email']; ?>" required="required" id="email" />
Password (<i>must include uppercase and lowercase letters, digits and special characters</i>) Password (<i>must include uppercase and lowercase letters, digits and special characters</i>)
<input type="password" class="form-control" name="password" placeholder="Enter password" required="required" id="pass1" /> <input type="password" class="form-control" name="password" placeholder="Enter password" required="required" id="password1" />
Confirm Password Confirm Password
<input type="password" class="form-control" name="confirmpassword" placeholder="Confirm password" required="required" id="pass2" /> <input type="password" class="form-control" name="confirmpassword" placeholder="Confirm password" required="required" id="password2" />
<br> <br>
<input type="submit" class="btn-primary" value="Sign up" id="sign_btn"> <input type="submit" class="btn-primary" value="Sign up" id="signup_btn">
<?php <?php
error_reporting(E_ALL); error_reporting(E_ALL);
if (isset($_SESSION['info_signup2'])) { if (isset($_SESSION['info_signup2'])) {

View File

@ -32,12 +32,12 @@ class Admin(Actor):
#Locate "Admin" tab. #Locate "Admin" tab.
wait = WebDriverWait(driver, 10) wait = WebDriverWait(driver, 10)
admin = wait.until(EC.presence_of_element_located((By.ID, "admin_btn"))) admin = wait.until(EC.presence_of_element_located((By.ID, "admin_tab")))
admin.click() admin.click()
#Locate "Create Lecturer/TA account" form #Locate "Create Lecturer/TA account" form
wait2 = WebDriverWait(driver, 10) wait2 = WebDriverWait(driver, 10)
new_account_form = wait2.until(EC.presence_of_element_located((By.ID, "create_acc_frm"))) new_account_form = wait2.until(EC.presence_of_element_located((By.ID, "create_account_form")))
#Fill in the form fields #Fill in the form fields
name_field = new_account_form.find_element(By.XPATH, "//input[@name='fullname']") name_field = new_account_form.find_element(By.XPATH, "//input[@name='fullname']")
@ -53,9 +53,9 @@ class Admin(Actor):
#If "Lecturer" is specified in type parameter, select Lecturer account type, else use default #If "Lecturer" is specified in type parameter, select Lecturer account type, else use default
if type == "Lecturer": if type == "Lecturer":
type_radio = new_account_form.find_element(By.ID, "rad_lec") type_radio = new_account_form.find_element(By.ID, "role_lecturer")
else: else:
type_radio = new_account_form.find_element(By.ID, "rad_ta") type_radio = new_account_form.find_element(By.ID, "role_TA")
type_radio.click() type_radio.click()
@ -92,7 +92,7 @@ class Admin(Actor):
#Locate the "Admin" tab. #Locate the "Admin" tab.
wait = WebDriverWait(driver, 10) wait = WebDriverWait(driver, 10)
admin = wait.until(EC.presence_of_element_located((By.ID, "admin_btn"))) admin = wait.until(EC.presence_of_element_located((By.ID, "admin_tab")))
admin.click() admin.click()
#Navigate to "Batch create form" #Navigate to "Batch create form"
@ -102,13 +102,13 @@ class Admin(Actor):
#Fill in the form #Fill in the form
wait3 = WebDriverWait(driver, 10) wait3 = WebDriverWait(driver, 10)
batch_form = wait3.until(EC.presence_of_element_located((By.ID, "batch_frm"))) batch_form = wait3.until(EC.presence_of_element_located((By.ID, "batch_form")))
text_area = batch_form.find_element(By.XPATH, "//textarea[@name='users']") text_area = batch_form.find_element(By.XPATH, "//textarea[@name='users']")
for i in range(len(lst)): for i in range(len(lst)):
text_area.send_keys(lst[i]+" ") text_area.send_keys(lst[i]+" ")
submit_btn = batch_form.find_element(By.ID, "reg_btn") submit_btn = batch_form.find_element(By.ID, "register_btn")
submit_btn.click() submit_btn.click()
except: except:
@ -139,7 +139,7 @@ class Admin(Actor):
#Locate the "Admin" tab. #Locate the "Admin" tab.
wait = WebDriverWait(driver, 10) wait = WebDriverWait(driver, 10)
admin = wait.until(EC.presence_of_element_located((By.ID, "admin_btn"))) admin = wait.until(EC.presence_of_element_located((By.ID, "admin_tab")))
admin.click() admin.click()
#Navigate to "Exisitin Accounts" table #Navigate to "Exisitin Accounts" table
@ -151,10 +151,10 @@ class Admin(Actor):
if op == "block": if op == "block":
#Locate first account and block it on existing account table #Locate first account and block it on existing account table
wait3 = WebDriverWait(driver, 10) wait3 = WebDriverWait(driver, 10)
button = driver.find_element(By.ID, "block_acc_1") button = driver.find_element(By.ID, "block_account_1")
elif op == "activate": elif op == "activate":
wait3 = WebDriverWait(driver, 10) wait3 = WebDriverWait(driver, 10)
button = driver.find_element(By.ID, "activate_acc_1") button = driver.find_element(By.ID, "activate_account_1")
driver.execute_script("arguments[0].click();", button) driver.execute_script("arguments[0].click();", button)

View File

@ -60,23 +60,23 @@ class Instructor(Actor):
#wait until the lab submission form shows up #wait until the lab submission form shows up
wait2 = WebDriverWait(driver, 10) wait2 = WebDriverWait(driver, 10)
new_lab_assignment_form = wait2.until(EC.presence_of_element_located((By.ID, "newlab_frm"))) new_lab_assignment_form = wait2.until(EC.presence_of_element_located((By.ID, "newlab_form")))
#Fill the required form fields and submit. #Fill the required form fields and submit.
lab_date = new_lab_assignment_form.find_element(By.ID, "date") lab_date = new_lab_assignment_form.find_element(By.ID, "date")
lab_date.send_keys(dateStr) lab_date.send_keys(dateStr)
lab_title = new_lab_assignment_form.find_element(By.ID, "lab_title") lab_title = new_lab_assignment_form.find_element(By.ID, "lab_title")
lab_title.send_keys("TESTASSIGNMENT"+str(dateStr)) lab_title.send_keys("TESTASSIGNMENT"+str(dateStr))
lab_instructions = new_lab_assignment_form.find_element(By.ID, "lab_inst") lab_instructions = new_lab_assignment_form.find_element(By.ID, "lab_instructor")
lab_instructions.send_keys("TESTINSTRUCTIONS"+str(dateStr)) lab_instructions.send_keys("TESTINSTRUCTIONS"+str(dateStr))
lab_marks = new_lab_assignment_form.find_element(By.ID, "lab_mark") lab_marks = new_lab_assignment_form.find_element(By.ID, "lab_mark")
lab_marks.send_keys("4") lab_marks.send_keys("4")
#if group == 0 select individual submission, if group == 1 select group submission #if group == 0 select individual submission, if group == 1 select group submission
if group == 0: if group == 0:
submission_type = new_lab_assignment_form.find_element(By.ID, "lab_ind") submission_type = new_lab_assignment_form.find_element(By.ID, "lab_individual")
elif group == 1: elif group == 1:
submission_type = new_lab_assignment_form.find_element(By.ID, "lab_grp") submission_type = new_lab_assignment_form.find_element(By.ID, "lab_group")
submission_type.click() submission_type.click()
submit = new_lab_assignment_form.find_element(By.ID, "submit_btn") submit = new_lab_assignment_form.find_element(By.ID, "submit_btn")
submit.click() submit.click()
@ -114,25 +114,25 @@ class Instructor(Actor):
timeStr = self.utility.getTime() timeStr = self.utility.getTime()
#Fill the required form fields and submit #Fill the required form fields and submit
course_name = driver.find_element(By.ID, "cname") course_name = driver.find_element(By.ID, "course_name")
course_name.send_keys("TESTCOURSE"+str(dateStr)+str(timeStr)) course_name.send_keys("TESTCOURSE"+str(dateStr)+str(timeStr))
#This URL is needed to access the same created course via its link in post_lab_report() method. #This URL is needed to access the same created course via its link in post_lab_report() method.
global courseURL global courseURL
courseURL = "TESTCOURSE"+str(dateStr)+str(timeStr) courseURL = "TESTCOURSE"+str(dateStr)+str(timeStr)
course_code = driver.find_element(By.ID, "ccode") course_code = driver.find_element(By.ID, "course_code")
course_code.send_keys("TC"+str(dateStr)+str(timeStr)) course_code.send_keys("TC"+str(dateStr)+str(timeStr))
self.utility.storeCourseCode("TC"+str(dateStr)+str(timeStr))#Store course code to be used self.utility.storeCourseCode("TC"+str(dateStr)+str(timeStr))#Store course code to be used
academic_year = driver.find_element(By.ID, "ayear") #later by student. academic_year = driver.find_element(By.ID, "academic_year") #later by student.
academic_year.send_keys("2021") academic_year.send_keys("2021")
faculty = driver.find_element(By.ID, "fac") faculty = driver.find_element(By.ID, "faculty")
faculty.send_keys("TESTING DEPARTMENT") faculty.send_keys("TESTING DEPARTMENT")
#If joining == 0 does not require join approval, if joining == 1 requires join approval #If joining == 0 does not require join approval, if joining == 1 requires join approval
if joining == 0 : if joining == 0 :
joining_students = driver.find_element(By.ID, "jno") joining_students = driver.find_element(By.ID, "join_no")
elif group == 1: elif group == 1:
joining_students = driver.find_element(By.ID, "jyes") joining_students = driver.find_element(By.ID, "join_yes")
joining_students.click() joining_students.click()
submit = driver.find_element(By.ID, "portal_btn") submit = driver.find_element(By.ID, "portal_btn")
submit.click() submit.click()

View File

@ -70,11 +70,11 @@ class MyUtility:
try: try:
driver = self.getSession() driver = self.getSession()
WebDriverWait(driver, 10) WebDriverWait(driver, 10)
username = driver.find_element(By.ID, "uname") username = driver.find_element(By.ID, "user_name")
username.send_keys(obj.getStudentID()) username.send_keys(obj.getStudentID())
password = driver.find_element(By.ID, "upass") password = driver.find_element(By.ID, "user_password")
password.send_keys(obj.getPassword()) password.send_keys(obj.getPassword())
login = driver.find_element(By.ID, "log_btn") login = driver.find_element(By.ID, "login_btn")
login.click() login.click()
return driver return driver
except: except:
@ -106,17 +106,17 @@ class MyUtility:
wait = WebDriverWait(driver, 10, ignored_exceptions='StaleElementReferenceException') wait = WebDriverWait(driver, 10, ignored_exceptions='StaleElementReferenceException')
#Click the sign up button, and fill the sign up form #Click the sign up button, and fill the sign up form
signup_btn = wait.until(EC.presence_of_element_located((By.ID, "signup_btn"))) signup_btn = wait.until(EC.presence_of_element_located((By.ID, "signup_link")))
signup_btn.click() signup_btn.click()
#Find and fill full student name #Find and fill full student name
wait2 = WebDriverWait(driver, 10) wait2 = WebDriverWait(driver, 10)
signup_form = wait2.until(EC.presence_of_element_located((By.ID, "signup_frm"))) signup_form = wait2.until(EC.presence_of_element_located((By.ID, "signup_form")))
name_field = signup_form.find_element(By.ID, "funame") name_field = signup_form.find_element(By.ID, "full_name")
name_field.send_keys(name) name_field.send_keys(name)
#Find and fill student ID #Find and fill student ID
student_id = signup_form.find_element(By.ID, "std_id") student_id = signup_form.find_element(By.ID, "student_id")
std_id = self.fetch_new_student_id() std_id = self.fetch_new_student_id()
student_id.send_keys(std_id) student_id.send_keys(std_id)
@ -125,15 +125,15 @@ class MyUtility:
email_field.send_keys(email) email_field.send_keys(email)
#Find and fill password #Find and fill password
password_field = signup_form.find_element(By.ID, "pass1") password_field = signup_form.find_element(By.ID, "password1")
password_field.send_keys(password) password_field.send_keys(password)
#Find and fill password confirmation #Find and fill password confirmation
re_password_field = signup_form.find_element(By.ID, "pass2") re_password_field = signup_form.find_element(By.ID, "password2")
re_password_field.send_keys(password) re_password_field.send_keys(password)
#Sign up new student #Sign up new student
submit = signup_form.find_element(By.ID, "sign_btn") submit = signup_form.find_element(By.ID, "signup_btn")
submit.click() submit.click()
return 0 return 0