forked from DevendraSS/Automation-In-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautomationMoodle_alpha0.0.1
More file actions
94 lines (64 loc) · 2.75 KB
/
automationMoodle_alpha0.0.1
File metadata and controls
94 lines (64 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import time
import tkinter as tk
from selenium import webdriver
from selenium.webdriver.common.by import By
from tkinter import *
driver = webdriver.Chrome()
def login(username, password):
# selenium code to open the window and
driver.get("http://moodle.mitsgwalior.in/login/index.php")
driver.maximize_window()
driver.find_element(By.ID, "username").send_keys(username)
driver.find_element(By.ID, "password").send_keys(password)
driver.find_element(By.ID, "loginbtn").click()
win.destroy()
def teachers(teachnames):
print(teachnames)
if teachnames.lower() == "dkj":
driver.get("http://moodle.mitsgwalior.in/course/view.php?id=344")
elif teachnames.lower() == "aso":
driver.get("http://moodle.mitsgwalior.in/course/view.php?id=355")
elif teachnames.lower() == "psharma":
driver.get("http://moodle.mitsgwalior.in/course/view.php?id=366")
elif teachnames.lower() == "sk":
driver.get("http://moodle.mitsgwalior.in/course/view.php?id=530")
elif teachnames.lower() == "ashish":
driver.get("http://moodle.mitsgwalior.in/course/view.php?id=771")
elif teachnames.lower() == "vs":
driver.get("http://moodle.mitsgwalior.in/course/view.php?id=724")
win = Tk()
#customization of the tkinter window
win.title("Moodle Automation")
win.geometry("400x350")
win.maxsize(500 ,500)
win.config(bg="lightgrey")
enter_info = Label(win, text="Moodle Automation", bg="lightgrey" , font=("Arial" , 14))
enter_info.grid(row=0, column=1, rowspan = 1 , columnspan=4, padx=5, pady=5)
enter_info = Label(win, text="version = 0.1.1", bg="lightgrey" )
enter_info.grid(row=1, column=1, rowspan = 1 , columnspan=4, padx=5, pady=5)
Label(win , text = "Username").grid(row=2)
Label(win , text = "Password").grid(row=3)
#userinput and password
userinput = Entry(win , width=35)
password = Entry(win, width=35,show="*")
userinput.grid(row=2 , column = 2 , padx = 20 ,pady=20)
password.grid(row=3,column=2 , padx = 20 , pady= 20)
#Button which says Click Here
tk.Button(win, text="Click Here to Start", command=lambda: login(userinput.get(), password.get())).grid(row =4 ,column =2 ,sticky=tk.W ,pady = 25 , padx=25)
win.mainloop()
root = Tk()
root.geometry("500x500")
#heading
canvas = Canvas(root)
canvas.create_text(200, 200, text="Moodle Automation", fill="black", font=('Helvetica 15 bold'))
canvas.create_text(200, 250, text="Who's page do you want to access?", fill="black")
canvas.create_text(200, 220, text="Version: 0.0.1", fill="black", font=('Helvetica 10 bold'))
canvas.pack()
#For entering a text
teachername = Entry(root)
teachername.pack()
#Button which says Click Here
button = Button(root, text="Click Here", command=lambda: teachers(teachername.get()))
button.pack()
root.mainloop()
time.sleep(5000)