def new_omegaPaper_add(self, model, elm1, elm2, elm3, elm4, elm5): self.add_question = Get_Element.Search_Page_Elements(self.driver) element = mongo.questionbasket() if element == "empty_questionbasket_haveyes": sleep(1) self.add_question.click_button(model, elm1) self.add_question.click_button(model, elm2) sleep(1) else: sleep(1) self.add_question.click_button(model, elm3) self.add_question.switch_page_three() self.question = Search_Question.Search_Question(self.driver) self.question.join_questionbasket() self.add_question.switch_page_close3_return2() sleep(2) # self.driver.find_element_by_css_selector( # ".ant-modal-close-x").click() self.add_question = Get_Element.Search_Page_Elements(self.driver) try: self.add_question.click_button(model, elm4) except: self.add_question.click_button( model, "new_edit_handout_addexample_subject_popupclose2") print("关闭成功") self.add_question.click_button(model, elm5) sleep(1) self.add_question.click_button(model, elm1) self.add_question.click_button(model, elm2)
def currency_method(self, model, elm1, elm2, elm3, elm4, elm5, elm6, elm7): self.edit_handout = Get_Element.Search_Page_Elements(self.driver) self.edit_handout.click_button(model, elm1) sleep(1) self.edit_handout.click_button(model, elm2) # sleep(1) self.edit_handout.click_button(model, elm3) sleep(1) element = mongo.questionbasket() if element == "empty_questionbasket_haveyes": self.edit_handout.click_button(model, elm4) # sleep(1) self.edit_handout.click_button(model, elm5) else: # sleep(1) self.edit_handout.click_button(model, elm6) self.edit_handout.switch_page_three() # sleep(1) self.question = Search_Question.Search_Question(self.driver) self.question.join_questionbasket() self.edit_handout.switch_page_close3_return2() sleep(1) self.edit_handout = Get_Element.Search_Page_Elements(self.driver) self.edit_handout.click_button(model, elm7) # self.driver.find_element_by_css_selector(".ant-modal-close-x").click() # try: # self.driver.find_element_by_xpath("/html/body/div[11]/div/div[2]/div/div[2]/button/span").click() # except: # print("关闭成功") sleep(1) self.edit_handout.click_button(model, elm3) sleep(1) self.edit_handout.click_button(model, elm4) # sleep(1) self.edit_handout.click_button(model, elm5)
def __init__(self, driver): self.driver = driver self.new_question1 = Get_Element.Search_Page_Elements(self.driver) self.method_newquestion = Method_NewQuestion.Method_NewQuestion( self.driver) self.model = ParseExcel.ParseExcel() self.value = self.model.getquestion_value()
def answer_question(self): # 题干 self.new_question4 = Get_Element.Search_Page_Elements(self.driver) self.new_question4.click_button("NewQuestion", "new_answer_question") self.new_question4.click_button("NewQuestion", "new_addsmall") self.new_question4.click_button("NewQuestion", "new_addsmall") self.new_question4.click_button("NewQuestion", "new_addsmall") self.new_question4.click_button("NewQuestion", "new_addsmall") sleep(1) self.new_question4.click_button("NewQuestion", "new_deletesmall") self.new_question4.click_button("NewQuestion", "new_deletesmall") self.new_question4.click_button("NewQuestion", "new_deletesmall") self.new_question4.click_button("NewQuestion", "new_deletesmall") self.method_newquestion.currency_method_answer( "NewQuestion", "new_stem_editor1", "new_stem_edit1", "new_stem_html", "new_stem_yesedit1", 'ueditor_5', '下列命题中,真命题是[[nn]]') self.method_newquestion.currency_method_answer( "NewQuestion", "new_answer_editor1", "new_answer_edit1", "new_analysis_html1", "new_answer_yesedit1", 'ueditor_6', 'a') self.method_newquestion.currency_method_answer( "NewQuestion", "new_analysis_editor1", "new_analysis_edit1", "new_analysis_html", "new_analysis_yesedit1", 'ueditor_7', '12364852') self.method_newquestion.currency_method_save( "NewQuestion", "new_remarks_editor1", "new_remarks_edit1", "new_remarks_html", "new_remarks_yesedit1", "new_question_preview", "new_question_save", 'ueditor_8', '12364852')
def get_omega_attribute(self): self.omegaPaper_page_new = Get_Element.Search_Page_Elements( self.driver) self.omegaPaper_page_new.move_between() self.name = self.omegaPaper_page_new.get_page_element_name( "RecordPaper", "omegapaper_name") self.count1 = self.omegaPaper_page_new.get_page_element_name( "RecordPaper", "omegapaper_listcount1") self.count2 = self.omegaPaper_page_new.get_page_element_name( "RecordPaper", "omegapaper_listcount2") self.classes = self.omegaPaper_page_new.get_page_element_name( "RecordPaper", "omegapaper_listclass") self.region = self.omegaPaper_page_new.get_page_element_name( "RecordPaper", "omegapaper_listregion") self.year = self.omegaPaper_page_new.get_page_element_name( "RecordPaper", "omegapaper_listyear") self.type = self.omegaPaper_page_new.get_page_element_name( "RecordPaper", "omegapaper_listtype") self.createman = self.omegaPaper_page_new.get_page_element_name( "RecordPaper", "omegapaper_listman") self.list = [ self.name, self.count1, '待标注:4', self.classes, self.region, self.year, self.type, self.createman ] return self.list
def edit_paper(self): Search_paper.button_search(self) self.search_paper.click_button("paper", "editpaper_name") self.search_paper.switch_new_page() sleep(1) self.search_paper.click_button("paper", "editpaper_go") self.search_paper.click_button("paper", "editpaper_moduleadd_add") sleep(1) element = mongo.questionbasket() if element == "empty_questionbasket_haveyes": self.search_paper.click_button("paper", "edit_paper_use") sleep(1) self.search_paper.click_button("paper", "edit_paper_useyes") else: # sleep(1) self.search_paper.click_button("paper", "edit_paper_popupadd") self.search_paper.switch_page_three() # sleep(1) self.question = Search_Question.Search_Question(self.driver) self.question.join_questionbasket() self.search_paper.switch_page_close3_return2() sleep(1) self.search_paper = Get_Element.Search_Page_Elements(self.driver) self.search_paper.click_button("paper", "editpaper_moduleadd_X1") sleep(1) self.search_paper.click_button("paper", "editpaper_moduleadd_add") sleep(1) self.search_paper.click_button("paper", "edit_paper_use") sleep(1) self.search_paper.click_button("paper", "edit_paper_useyes") sleep(2)
def screen_condition(self): self.search_handout = Get_Element.Search_Page_Elements(self.driver) self.search_handout.move_top() self.search_handout.move_mouse("Navigation", "move_mouse_my") sleep(1) self.search_handout.click_button("Navigation", "button_myhandout") sleep(1)
def currency_method_stem_picture(self, model, elm1, elm2, elm3, elm4, elm5, elm6, iframe, str): self.new_question = Get_Element.Search_Page_Elements(self.driver) self.new_question.move_mouse(model, elm1) self.new_question.click_button(model, elm2) try: self.new_question.click_button(model, elm2) except ElementNotInteractableException: print(5) sleep(1) self.new_question.click_button(model, elm3) sleep(1) self.new_question.click_button(model, elm3) sleep(1) self.new_question.click_button(model, elm4) # self.new_question.click_button(model, elm5) # self.new_question.input_string(picture_file, model, elm5) self.iframe = Browser_Controller.Browser_Controller(self.driver) self.iframe.switch_to_iframe(iframe) self.driver.find_element('tag name', 'body').send_keys(str) self.iframe.switch_to_default_content() sleep(1) try: self.new_question.click_button(model, elm6) except ElementNotInteractableException: print(6)
def currency_method(self, model, elm1, elm2, elm3, elm4, elm5, elm6, elm7): self.edit_handout = Get_Element.Search_Page_Elements(self.driver) self.edit_handout.click_button(model, elm1) sleep(1) self.edit_handout.click_button(model, elm2) # sleep(1) self.edit_handout.click_button(model, elm3) sleep(1) element = mongo.questionbasket() if element == "empty_questionbasket_haveyes": self.edit_handout.click_button(model, elm4) # sleep(1) self.edit_handout.click_button(model, elm5) else: # sleep(1) self.edit_handout.click_button(model, elm6) self.edit_handout.switch_page_three() # sleep(1) self.question = Search_Question.Search_Question(self.driver) self.question.join_questionbasket() self.edit_handout.switch_page_close3_return2() # sleep(1) self.edit_handout.click_button(model, elm7) # sleep(1) self.edit_handout.click_button(model, elm3) sleep(1) self.edit_handout.click_button(model, elm4) # sleep(1) self.edit_handout.click_button(model, elm5)
def currency_method_save(self, model, elm1, elm2, elm3, elm4, elm5, elm6, iframe, str): Method_NewQuestion.currency_method(self, model, elm1, elm2, elm3, elm4, iframe, str) self.new_question = Get_Element.Search_Page_Elements(self.driver) self.new_question.click_button(model, elm5) self.new_question.click_button(model, elm6)
def details_question(self): self.question_operation = Get_Element.Search_Page_Elements(self.driver) self.question_operation.click_button( "handout", "new_edit_handout_question_details") self.question_operation.switch_page_three() self.question_operation.switch_page_close3_return2() sleep(2)
def open_question(self): self.question_operation = Get_Element.Search_Page_Elements(self.driver) # sleep(10) # self.question_operation.click_button("handout", "new_edit_handout_question_open") # self.question_operation.click_button("handout", "new_edit_handout_question_open") self.driver.find_element_by_css_selector( "i.anticon.anticon-down > svg").click() sleep(1) self.driver.find_element_by_css_selector( "i.anticon.anticon-up > svg").click()
def new_omegaPaper_new(self): self.omegaPaper_page_new = Get_Element.Search_Page_Elements( self.driver) self.omegaPaper_page_new.click_button("RecordPaper", "new_omegapaper_new") sleep(1) self.newquestion = OmegaMethod.Method_Omega(self.driver) self.newquestion.choice_question() New_OmegaPaper.similar(self) self.omegaPaper_page_new.click_button("RecordPaper", "omegapaper_back") self.omegaPaper_page_new.switch_page_close()
def new_omegaPaper_add(self): self.omegaPaper_page_add = Get_Element.Search_Page_Elements( self.driver) self.omegaPaper_page_add.click_button("RecordPaper", "new_omegapaper_add") self.method_newquestion.new_omegaPaper_add( "RecordPaper", "new_edit_handout_addexample_subject_use", "new_edit_handout_addexample_subject_useyes", "new_edit_handout_addexample_subject_popupadd", "new_edit_handout_addexample_subject_popupclose", "new_omegapaper_add")
def insert_question(self): self.question_operation = Get_Element.Search_Page_Elements(self.driver) self.question_operation.click_button( "handout", "new_edit_handout_question_insert") self.method_newquestion = Method_Question.Method_AddQuestion( self.driver) self.method_newquestion.new_omegaPaper_add( "handout", "new_edit_handout_addexample_subject_use", "new_edit_handout_addexample_subject_useyes", "new_edit_handout_addexample_subject_popupadd", "new_edit_handout_addexample_subject_popupclose", "new_edit_handout_question_insert")
def source_question(self): self.question_operation = Get_Element.Search_Page_Elements(self.driver) sleep(1) self.question_operation.click_button( "handout", "new_edit_handout_question_source1") sleep(1) self.question_operation.click_button( "handout", "new_edit_handout_question_source_display") self.question_operation.click_button( "handout", "new_edit_handout_question_source_name") self.question_operation.click_button( "handout", "new_edit_handout_question_source_ok")
def source_question_input(self): self.question_operation = Get_Element.Search_Page_Elements(self.driver) sleep(1) self.question_operation.click_button( "handout", "new_edit_handout_question_source") sleep(1) self.question_operation.click_button( "handout", "new_edit_handout_question_source_display") self.question_operation.input_string( "测试出处", "handout", "new_edit_handout_question_source_input") self.question_operation.click_button( "handout", "new_edit_handout_question_source_ok")
def edit_omegaPaper_batch(self): self.omegaPaper_page_new = Get_Element.Search_Page_Elements( self.driver) self.omegaPaper_page_new.click_button("RecordPaper", "new_omegapaper_batch") self.omegaPaper_page_new.input_string("5ea92bb9f2c315000bfbb4fd", "RecordPaper", "new_omegapaper_batch_input") self.omegaPaper_page_new.move_bottom() sleep(1) self.omegaPaper_page_new.click_button("RecordPaper", "new_omegapaper_batchsave") sleep(3)
def menu(self): self.edit_paper = Get_Element.Search_Page_Elements(self.driver) self.edit_paper.click_button("paper", "editpaper_openmenu") sleep(1) self.edit_paper.doubleclick_button("paper", "editpaper_modelgrade") self.edit_paper.input_string("10", "paper", "editpaper_modelgrade_input") self.edit_paper.enter_input("paper", "editpaper_modelgrade_input") self.edit_paper.click_button("paper", "editpaper_questiongopen") sleep(1) self.edit_paper.doubleclick_button("paper", "editpaper_questiongrade") self.edit_paper.input_string("20", "paper", "editpaper_questiongrade_input") self.edit_paper.enter_input("paper", "editpaper_questiongrade_input")
def similar(self): self.omegaPaper_page_new = Get_Element.Search_Page_Elements( self.driver) self.omegaPaper_page_new.click_button("RecordPaper", "omegapaper_similar") sleep(1) self.omegaPaper_page_new.click_button("RecordPaper", "omegapaper_similar_use") sleep(1) self.omegaPaper_page_new.click_button("RecordPaper", "omegapaper_similar") sleep(1) self.omegaPaper_page_new.click_button("RecordPaper", "omegapaper_similar_use1") sleep(1)
def currency_method_save_cut(self, model, elm1, elm2, elm3, elm4, elm5, elm6, elm7, elm8, iframe, str): Method_NewQuestion.currency_method(self, model, elm1, elm2, elm3, elm4, iframe, str) self.new_question = Get_Element.Search_Page_Elements(self.driver) self.new_question.click_button(model, elm5) self.new_question.click_button(model, elm6) #排版 typesetting_name = self.new_question.get_page_element_name(model, elm7) sleep(3) self.new_question.cut('试题' + typesetting_name) self.new_question.click_button(model, elm8) #详情 details_name = self.new_question.get_page_element_name(model, elm8) self.new_question.cut('试题' + details_name) sleep(1)
def replace_question(self): self.question_operation = Get_Element.Search_Page_Elements(self.driver) self.question_operation.click_button( "handout", "new_edit_handout_question_replace") # try: # self.question_operation.click_button("handout", "new_edit_handout_question_replace") # except: # print("replace") self.method_newquestion = Method_Question.Method_AddQuestion( self.driver) self.method_newquestion.new_omegaPaper_add( "handout", "new_edit_handout_addexample_subject_use", "new_edit_handout_addexample_subject_useyes", "new_edit_handout_addexample_subject_popupadd", "new_edit_handout_addexample_subject_popupclose", "new_edit_handout_question_replace")
def edit_omegaPaper_batch(self): self.omegaPaper_page_new = Get_Element.Search_Page_Elements( self.driver) self.omegaPaper_page_new.click_button("RecordPaper", "new_omegapaper_batch") self.omegaPaper_page_new.input_string("5ea92bb9f2c315000bfbb4fd", "RecordPaper", "new_omegapaper_batch_input") self.omegaPaper_page_new.move_bottom() sleep(1) self.omegaPaper_page_new.click_button("RecordPaper", "new_omegapaper_batchsave") sleep(3) self.list = New_OmegaPaper.get_omegaedit_attribute(self) # self.omegaPaper_page_new.click_button("RecordPaper", "omegapaper_editback") self.driver.find_element(By.CSS_SELECTOR, "div > .anticon-left > svg").click() return self.list
def omega_adaptation_question(self): self.question_operation = Get_Element.Search_Page_Elements(self.driver) self.question_operation.click_button( "handout", "new_edit_handout_question_adaptation") self.question_operation.switch_page_three() self.newquestion = New_Question.New_Question(self.driver) state_choice = self.question_operation.radio_state( "NewQuestion", "new_choice_question") state_completion = self.question_operation.radio_state( "NewQuestion", "new_completion_question") state_answer = self.question_operation.radio_state( "NewQuestion", "new_answer_question") if state_choice == True: self.newquestion.choice_question() elif state_completion == True: self.newquestion.completion_question() else: self.newquestion.omegapaper_adaptation_answer_question() self.question_operation.switch_page_close3_return2()
def choice_question(self): # 题干 self.method_newquestion = Method_NewQuestion.Method_NewQuestion( self.driver) self.method_newquestion.currency_method_stem_picture( "NewQuestion", "new_stem_editor", "new_stem_edit", "new_stem_html", "new_answering_position", "new_upload_pictures", "new_option_yesedits", 'ueditor_0', 'A.菱形的对角线互相平分且相等' 'B.矩形的对角线互相垂直平分' 'C.对角线相等且垂直的四边形是正方形' 'D.对角线互相平分的四边形是平行四边形.') # self.method_newquestion.currency_method_stemswitch("NewQuestion", "new_stem_editor", "new_stem_edit", # "new_stem_html", # "new_answering_position", "new_option_yesedit", # "new_choice_question", 'ueditor_0', 'A.菱形的对角线互相平分且相等' # 'B.矩形的对角线互相垂直平分' # 'C.对角线相等且垂直的四边形是正方形' # 'D.对角线互相平分的四边形是平行四边形.') self.method_newquestion.currency_method_stem_option( "NewQuestion", "new_option_editor", "new_option_edit", "new_option_html", "new_insert_options", "new_option_yesedit", 'ueditor_1', self.value['choice_option']) self.method_newquestion.currency_method( "NewQuestion", "new_answer_editor", "new_answer_edit", "new_answer_yesedit", "new_answer_yesedit", 'ueditor_2', self.value['choice_answer']) # 解析 self.method_newquestion.currency_method_answer( "NewQuestion", "new_analysis_editor", "new_analysis_edit", "new_analysis_html", "new_analysis_yesedit", 'ueditor_3', self.value['choice_analysis']) # 备注 self.method_newquestion.currency_method( "NewQuestion", "new_remarks_editor", "new_remarks_edit", "new_remarks_yesedit", "new_remarks_html", 'ueditor_4', self.value['choice_remarks']) self.new_question = Get_Element.Search_Page_Elements(self.driver) self.new_question.click_button("NewQuestion", "new_question_save_omega")
def new_omegaPaper_add(self, model, elm1, elm2, elm3, elm4, elm5): self.add_question = Get_Element.Search_Page_Elements(self.driver) element = mongo.questionbasket() if element == "empty_questionbasket_haveyes": sleep(1) self.add_question.click_button(model, elm1) self.add_question.click_button(model, elm2) sleep(1) else: sleep(1) self.add_question.click_button(model, elm3) self.add_question.switch_page_three() self.question = Search_Question.Search_Question(self.driver) self.question.join_questionbasket() self.add_question.switch_page_close3_return2() self.add_question.click_button(model, elm4) self.add_question.click_button(model, elm5) sleep(1) self.add_question.click_button(model, elm1) self.add_question.click_button(model, elm2)
def test_search(self, loginname, password): login_page = Get_Element.Search_Page_Elements(self.driver) try: login_page.input_string(loginname, "login", "search_loginname") login_page.input_string(password, "login", "search_password") # login_page.click_button("login", "button_remember") # login_page.click_button("login", "button_remember") # login_page.click_button("login", "button_class_subject") # sleep(1) # login_page.click_button("login", "button_class") # sleep(1) # login_page.click_button("login", "button_subject") login_page.click_button("login", "button_login") sleep(1) login_page.move_bottom() login_page.click_button("login", "button_class_subject") login_page.click_button("login", "button_enter") sleep(1) except AssertionError as e: raise e
def addexmple(self, model, elm1, elm2, elm3, elm4, elm5, elm6, elm7, elm8, elm9, elm10): self.edit_handout = Get_Element.Search_Page_Elements(self.driver) self.edit_handout.click_button(model, elm1) sleep(1) self.edit_handout.click_button(model, elm2) # sleep(1) self.edit_handout.click_button(model, elm3) sleep(1) self.edit_handout.click_button(model, elm4) sleep(2) self.edit_handout.click_button(model, elm5) sleep(2) self.edit_handout.click_button(model, elm6) sleep(2) self.edit_handout.click_button(model, elm7) self.edit_handout.move_between() self.edit_handout.click_button(model, elm8) self.edit_handout.move_bottom() self.edit_handout.click_button(model, elm9) self.edit_handout.click_button(model, elm10)
def adaptation_question(self): self.question_operation = Get_Element.Search_Page_Elements(self.driver) sleep(1) self.question_operation.click_button( "handout", "new_edit_handout_question_adaptation") self.question_operation.switch_page_three() # self.newquestion = New_Question.New_Question(self.driver) # state_choice = self.question_operation.radio_state("NewQuestion", "new_choice_question") # state_completion = self.question_operation.radio_state("NewQuestion", "new_completion_question") # state_answer = self.question_operation.radio_state("NewQuestion", "new_answer_question") # if state_choice == True: # self.newquestion.choice_question() # elif state_completion == True: # self.newquestion.omega_completion_question() # else: # try: # self.newquestion.adaptation_answer_question() # except Exception: # print("解答题暂未兼容存量题") self.question_operation.switch_page_close3_return2() sleep(2)
def currency_method_stem_option( self, model, elm1, elm2, elm3, elm4, elm5, iframe, str, ): self.new_question = Get_Element.Search_Page_Elements(self.driver) self.new_question.move_mouse(model, elm1) self.new_question.click_button(model, elm2) try: self.new_question.click_button(model, elm2) except ElementNotInteractableException: print(5) sleep(1) try: self.new_question.click_button(model, elm3) except: self.new_question.click_button("NewQuestion", "new_stem_html") sleep(1) try: self.new_question.click_button(model, elm3) except: self.new_question.click_button("NewQuestion", "new_stem_html") sleep(1) self.new_question.click_button(model, elm4) self.iframe = Browser_Controller.Browser_Controller(self.driver) self.iframe.switch_to_iframe(iframe) self.driver.find_element('tag name', 'body').send_keys(str) self.iframe.switch_to_default_content() sleep(1) try: self.new_question.click_button(model, elm5) except ElementNotInteractableException: print(6)