def test_question(self): self.driver.get(AnswerPage.user_url) login.user_login(self, self.username, self.password) add_question = AnswerPage.StudentAnswer(self.driver, AnswerPage.user_url, u"金桥微课 - Index") add_question.click_close() add_question.click_list() add_question.input_textarea("hello world!") add_question.click_submit()
def test_test(self): u'''资料''' self.driver.get(FilesPage.user_url) login.user_login(self,self.username,self.password) user_test=FilesPage.FilePage(self.driver,FilesPage.user_url,u"金桥微课 - Index") user_test.click_close() user_test.click_list() user_test.click_files() user_test.click_file() time.sleep(5)
def test_answer(self): self.driver.get(AnswerPage.user_url) login.user_login(self, self.username, self.password) answer_question = AnswerPage.TeacherAnswer(self.driver, AnswerPage.user_url, u"金桥微课 - Index") answer_question.click_list() answer_question.click_answer() answer_question.click_count() answer_question.input_textarea("welcome") answer_question.click_submit()
def test_tst(self): u'''测验''' self.driver.get(ExamPage.user_url) login.user_login(self, self.username, self.password) user_test = ExamPage.TestPage(self.driver, ExamPage.user_url, u"金桥微课 - Index") user_test.click_close() user_test.click_list() user_test.click_tst() user_test.click_submit() assert user_test.p_title(), u"《第1章 html5概述》测验"
def test_addnote(self): u'''添加笔记''' self.driver.get(NotePage.note_url) login.user_login(self, self.username, self.password) add_note = NotePage.NotePage(self.driver, NotePage.note_url, u"金桥微课 - Index") add_note.click_close() add_note.click_list() add_note.click_course() add_note.click_note() add_note.type_note("123456") add_note.click_submit()
def test_exam(self): u'''考试''' self.driver.get(ExamPage.user_url) login.user_login(self, self.username, self.password) user_exam = ExamPage.ExamPage(self.driver, ExamPage.user_url, u"金桥微课 - Index") user_exam.click_close() user_exam.click_list() user_exam.click_exam() user_exam.click_texam() time.sleep(5) user_exam.click_submit() assert user_exam.p_title(), u"《excel课程》考试"
def test_error(self): u'''账号密码错误''' driver = self.driver driver.get(self.base_url) logins = root.getElementsByTagName('error') #获得null标签的username、passwrod属性值 username = logins[0].getAttribute("username") password = logins[0].getAttribute("password") prompt_info = logins[0].firstChild.data #登录 login.user_login(self, username, password) ##获取断言信息进行断言 text = driver.find_element_by_id("msgdiv").text self.assertEqual(text, prompt_info)
def test_addhomework(self): self.driver.get(HoWorkPage.user_url) login.user_login(self,self.username,self.password) add_homework=HoWorkPage.HoWorkPage(self.driver,HoWorkPage.user_url,u"金桥微课 - Index") add_homework.click_list() add_homework.click_home() t=self.driver.title assert t,u"金桥微课 - Detail Myclasses" try: add_homework.click_ho() add_homework.type_workname("ceshi") add_homework.type_workcontent("123") add_homework.type_workdate('2018/08/30') add_homework.click_submit() t=add_homework.assert_homework() assert t,"ceshi" except: pass
def test_home(self): self.driver.get(HoWorkPage.user_url) login.user_login(self, self.username, self.password) shome_page = HoWorkPage.SHomePage(self.driver, HoWorkPage.user_url, u"金桥微课 - Index") shome_page.click_message() shome_page.click_course() t = self.driver.title assert t, u"Html5+css3基础教程" try: shome_page.click_work() shome_page.click_home() self.driver.find_element_by_id("exampleInputFile").send_keys( "E:\\test\\1.png") #shome_page.send_inputfile("E:\\test\\1.png") shome_page.click_submit() shome_page.click_comfirm() time.sleep(2) assert shome_page.assert_cherk(), u"待批改" except: pass