-
Notifications
You must be signed in to change notification settings - Fork 0
/
CurtinDriver.py
executable file
·64 lines (39 loc) · 1.5 KB
/
CurtinDriver.py
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
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.options import Options
from time import sleep
import sys
import csv
class CurtinDriver:
'''methods for each task you want to do'''
def gotosearch(driver):
driver.get("http://timetable.student.curtin.edu.au/criteriaEntry.jsf")
assert "Plan Your Timetable" in driver.title
def blank(driver):
assert "Plan Your Timetable" in driver.title
#clear search
elem = driver.find_element_by_name("criteriaEntry:filterUnitCodeOrTitle")
elem.clear()
#elem.send_keys("pycon")
#elem.send_keys(Keys.RETURN)
#assert "No results found." not in driver.page_source
def clearunits(driver):
clear = driver.find_element_by_name("criteriaEntry:removeAllButton")
clear.click()
def search(driver):
assert "Plan Your Timetable" in driver.title
#search for all units
srch = driver.find_element_by_name("criteriaEntry:unitSearchButton")
srch.click()
def selectunit(driver, classcode):
assert "Plan Your Timetable" in driver.title
rndclass = driver.find_element_by_xpath("//option[@value=" + classcode + "]")
rndclass.click()
def addunit(driver):
assert "Plan Your Timetable" in driver.title
add = driver.find_element_by_name("criteriaEntry:addButton")
add.click()
def viewtimetable(driver):
assert "Plan Your Timetable" in driver.title
view = driver.find_element_by_name("criteriaEntry:timetableForUnitsButton")
view.click()