def test_001_loginoffline(self): #下面一句的文字,是通过Python的一种注释doc string,用于函数、类和方法的描述,HTMLTestRunner可以读取此类型注释 """ 测试创建线下会 """ base.deprint("开始执行登录,并进入线下会用例") dr = self.driver object = LoginPage(dr) object.login() object = ChoosePage(dr) object.click_menu_bt('10') object = IndexPage(dr) object.click_createunderline() object = NewMeetingPage(dr) actual_result = object.create_neww_offline() expected_result = u'线下会创建成功' self.assertEqual(actual_result, expected_result, msg="failed") base.deprint("创建线下会页面用例执行完成")
def nameofform(self, form_name): #点击选择 self.element_click('x', '//*[@id="createSeminarScroller"]/form/div[8]/div[2]/div/button/span') for num in range(1, 100): #遍历选项,选中form_name 因为遍历100遍,及100个下表元素。如果没有正确选中,很有可能找不到元素,报错。 ele = '//*[@id="createSeminarScroller"]/form/div[8]/div[2]/div/ul/li[' + str(num) + ']/a' # print "ele:",ele all_form_name = self.find_element_text("x", ele) # 获各个注册单名称 # print "all_form_name:",all_form_name if all_form_name == form_name: # 判断对应注册单的名称,点击选择 self.element_click("x", ele) break if __name__ == '__main__': dr = brower() object = LoginPage(dr) object.login() object = ChoosePage(dr) object.click_menu_bt('9') object = IndexPage(dr) object.click_createunderline() object = NewMeetingPage(dr) # object.nameofform(u"新建注册表单(9)") object.create_neww_offline() # object.quit()