• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python user.login函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中user.login函数的典型用法代码示例。如果您正苦于以下问题:Python login函数的具体用法?Python login怎么用?Python login使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了login函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_mycomment_03

 def test_mycomment_03(self):
     '''删除发出的评论'''
     driver = self.driver
     driver.get(self.base_url)     
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//li[4]/a/strong").click()
     time.sleep(2)
     self.assertEqual("我的评论",driver.find_element_by_xpath("/html/body/div/div/div[2]/div[1]/div/div/div/span").text)
     driver.find_element_by_xpath("//div[2]/div/div/ul/li[2]/a").click()
     time.sleep(2)
     del_before = driver.find_element_by_xpath("/html/body/div/div/div[2]/div[2]/div/table/tbody/tr[1]/td/div[1]/span[1]").text
     driver.find_element_by_xpath("//a[contains(text(),'删除')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'取消')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'删除')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'确定')]").click()
     time.sleep(2)
     del_after = driver.find_element_by_xpath("/html/body/div/div/div[2]/div[2]/div/table/tbody/tr[1]/td/div[1]/span[1]").text
     if del_after != del_before:
         print u"删除成功!目前最新的评论内容是:%s"%del_after
     else:
         print u"删除失败!"
     user.quit(self)
开发者ID:zhoubin-20151109,项目名称:webcd_test,代码行数:30,代码来源:at_worklog4_mycomment.py


示例2: test_notice_04

 def test_notice_04(self):
     '''编辑公告'''
     driver = self.driver
     user.login(self)
     sleep(2)
     pub.equal(self)
     print driver.title
     sleep(1)
     page_notice.gotoNotice(self)
     driver.find_element_by_css_selector('div.list-title-span.ellipsis').click()
     sleep(1)
     driver.find_element_by_xpath("//div[@id='main_notice_right']/div/div/div/button").click()
     sleep(1)
     now = pub.now()
     driver.find_element_by_css_selector('input[type="text"]').clear()
     driver.find_element_by_css_selector('input[type="text"]').send_keys(u'编辑公告标题-%s'%now)
     sleep(1)
     driver.find_element_by_xpath("//div[@id='addScrollDiv']/ul/li[9]/button").click()
     title = driver.find_element_by_xpath('//*[@id="notice-detail-warp"]/div[1]/div[1]/div[2]').text
     try:
         self.assertEqual(u'编辑公告标题-%s'%now,title)
         # if title == u'编辑公告标题-%s'%now:
         print u'公告编辑成功!编辑后的公告标题为:%s'%title
     except:
         print u'公告编辑失败!'
开发者ID:jmb-cd,项目名称:webcd_test,代码行数:25,代码来源:test_notice.py


示例3: test_project_status_5

 def test_project_status_5(self):
     '''修改项目'''
     driver = self.driver
     user.login(self)
     time.sleep(2)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_project").click()
     pub.switchtoframe(self)
     #筛选状态为实现中的项目,修改第一个项目
     driver.find_element_by_id("statusFilter").click()
     time.sleep(0.5)
     filt = driver.find_element_by_id("mainStatusChange")
     time.sleep(1)
     filt.find_element_by_xpath("//option[@value='0']").click()
     time.sleep(1)
     driver.find_element_by_xpath("//td[3]/a").click()
     time.sleep(2)
     driver.find_element_by_xpath("//input[@value='修改']").click()
     time.sleep(2)
     driver.find_element_by_id("targetName").clear()
     driver.find_element_by_id("targetName").send_keys(u"修改项目名称_%s"%time.strftime("%Y%m%d_%H%M%S",time.localtime()))
     time.sleep(2)
     driver.find_element_by_id("editTargetReason").clear()
     driver.find_element_by_id("editTargetReason").send_keys(u"修改理由@%s"%time.ctime())
     time.sleep(2)
     driver.find_element_by_id("submitAdd").click()
     time.sleep(1)
     driver.find_element_by_id("mgtConfirmDivId").find_element_by_id("confirmOk").click()
     print u"修改成功!修改理由@%s"%time.ctime()
     time.sleep(2)
     user.quit(self)
开发者ID:jmb-cd,项目名称:webcd_test,代码行数:31,代码来源:at_project1_status.py


示例4: test_knowmob_2

 def test_knowmob_2(self):
     '''发表评论'''
     driver = self.driver
     user.login(self)
     driver.get(self.base_url + "/module/knowledge/index.m")        
     time.sleep(2)
     num = randint(3,16)
     driver.find_element_by_xpath("//div[%s]/div/div/a/strong"%num).click()
     time.sleep(1)
     driver.find_element_by_xpath("//button[@id='commBtn']").click()
     time.sleep(1)
     self.assertEqual("评论知识",driver.find_element_by_xpath("/html/body/div[1]/div/div[1]/div[2]/h4/strong").text)
     comments = open("D:\\work\\mgt_webtest\\data\\know_commentContent.txt")
     comment = comments.readlines()
     comments.close()
     for comm in comment:
         time.sleep(1)
         driver.find_element_by_xpath("//*[@id='commentContent']").clear()
         driver.find_element_by_xpath("//*[@id='commentContent']").send_keys('%s'%comm)
         time.sleep(2)
         driver.find_element_by_xpath("//*[@id='commSubBtn']").click()
         if len(comm.strip()) == 0:#comm.strip()=='':
             driver.get_screenshot_as_file("D:\\work\\mgt_webtest\\screenshot\\knowcommentnull%s.png"%time.strftime("%Y%m%d%H%M%S",time.localtime()))
             print u"评论内容为空!提示信息可见截图:\\screenshot_png\\knowcommentnull%s.png"%time.strftime("%Y%m%d%H%M%S",time.localtime())
         elif len(comm.strip()) > 20000:
             print u"评论内容字符长度大于20000,不允许提交!"
             driver.find_element_by_xpath("//*[@id='commCancel']").click()
         else:
             print u"操作成功!评论内容是:%s"%comm
             time.sleep(1)
             driver.find_element_by_xpath("//button[@id='commBtn']").click()
         time.sleep(3)
     user.quit_m(self)
开发者ID:zhoubin-20151109,项目名称:webcd_test,代码行数:33,代码来源:at_know_m.py


示例5: test_knowmob_3

 def test_knowmob_3(self):
     '''显示较早评论'''
     driver = self.driver
     user.login(self)
     driver.get(self.base_url + "/module/knowledge/index.m")
     time.sleep(2)
     num = randint(3,16)
     driver.find_element_by_xpath("//div[%s]/div/div/a/strong"%num).click()
     time.sleep(1)
     comments = open("D:\\work\\mgt_webtest\\data\\know_commentContent_1.txt")
     comment = comments.readlines()
     comments.close()
     for comm in comment:
         driver.find_element_by_xpath("//button[@id='commBtn']").click()
         time.sleep(2)
         self.assertEqual("评论知识",driver.find_element_by_xpath("/html/body/div[1]/div/div[1]/div[2]/h4/strong").text)
         driver.find_element_by_xpath("//*[@id='commentContent']").clear()
         #unicode(rst,errors='ignore')
         driver.find_element_by_xpath("//*[@id='commentContent']").send_keys('%s'%comm)
         time.sleep(3)
         driver.find_element_by_xpath("//*[@id='commSubBtn']").click()
         print u"操作成功!评论内容是:%s"%comm
         time.sleep(3)
     self.assertEqual(u"显示较早的评论...",driver.find_element_by_link_text(u"显示较早的评论...").text)
     driver.find_element_by_link_text(u"显示较早的评论...").click()
     time.sleep(3)
     user.quit_m(self)
开发者ID:zhoubin-20151109,项目名称:webcd_test,代码行数:27,代码来源:at_know_m.py


示例6: test_viewlog_03

 def test_viewlog_03(self):
     '''删除评阅日志'''
     driver = self.driver
     driver.get(self.base_url)     
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//li[5]/a/strong").click()
     time.sleep(2)
     self.assertEqual("评阅日志",driver.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[1]/div/span").text)
     driver.find_element_by_xpath("//div[@id='viewlogList']/table/tbody/tr/td/div").click()
     time.sleep(2)
     theFirstInfo = driver.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[4]/div/div/div[6]/div/table/tbody/tr[2]/td").text
     driver.find_element_by_xpath("//a[contains(text(),'删除')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'取消')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'删除')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'确定')]").click()
     time.sleep(2)
     #self.verifyEqual(theFirstInfo,driver.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[4]/div/div/div[6]/div/table/tbody/tr[2]/td").text)
     if theFirstInfo != driver.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[4]/div/div/div[6]/div/table/tbody/tr[2]/td").text:
         print u"删除成功!"
         print u"删除的评论内容是:%s"%theFirstInfo
     else:
         print u"删除失败"
     user.quit(self)
开发者ID:zhoubin-20151109,项目名称:webcd_test,代码行数:31,代码来源:at_worklog5_viewlog.py


示例7: intercept

def intercept():
    '''
    This function will be invoked when a dynamic request comes.
    It firstly gets request path from evironment variables,
    then invokes corresponding functions according to request path.
    '''
    env = os.environ
    # Get request uri from environment variables 
    uri = env['REQUEST_URI']
    # Get request path, leaving out query string
    path = uri.split('?', 1)[0]
    # Construct HTTPResquest object
    req = request.HTTPRequest()
    
    # Invoke corresponding functions according to request path
    if path == '/register':
        user.register(req)
    elif path == '/login':
        user.login(req)
    elif path == '/logout':
        user.logout(req)
    elif path == '/info':
        user.showinfo(req)
    elif path == '/upload':
        avatar.upload_avatar(req)
    elif re.compile(r'/avatar/(?P<md5>[\w]+)').match(path):
        # Get 32-char long md5, leaving out file ext or other chars.
        # If the length of md5 part is less than 32, get all the part. 
        md5 = path[8:40]
        avatar.back_avatar(md5)
    else:
        util.msg_redirect('/static/homepage.html','unsupported url')
开发者ID:xiongjp,项目名称:minusone,代码行数:32,代码来源:interceptor.py


示例8: test_newweekplan

 def test_newweekplan(self):
     '''新建周计划'''
     driver = self.driver
     driver.get(self.base_url)# + "/mgt/frame.jsp?url=MGT_PLN")
     user.login(self)
     time.sleep(2)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_plan").click()
     time.sleep(2)
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//span[@id='realname']").click()
     time.sleep(1)
     
     try:
         driver.find_element_by_xpath("//div[@id='submitButton']/input[2]").click()
         time.sleep(1)
         now = time.strftime('%Y-%m-%d_%H-%M-%S',time.localtime())
         driver.find_element_by_name("modifyTitle").click()
         time.sleep(1)
         driver.find_element_by_id("planTitle").clear()
         driver.find_element_by_id("planTitle").send_keys(u"新计划标题:%s"%now)
         driver.find_element_by_xpath("//div[@id='hideTitleDiv']/span/input[2]").click()        
         time.sleep(1)
         driver.find_element_by_xpath("//input[@value='立即发布当前计划']").click()#/html/body/div[5]/div/div[2]/div/div/table/tbody/tr/td/div/div[3]/div/div/input
         driver.find_element_by_id("mgtConfirmDivId").find_element_by_id("confirmOk").click()
         time.sleep(3)
         print u"新建周计划成功,周计划标题是:%s"%now
     except:
         print u"本周周计划已存在,测试结束!"   
开发者ID:zhoubin-20151109,项目名称:webcd_test,代码行数:29,代码来源:at_plan.py


示例9: test_project_status_3

 def test_project_status_3(self):
     '''撤销项目'''
     driver = self.driver
     driver.get(self.base_url)# + "/mgt/frame.jsp?url=MGT_PROJECT_MY")        
     user.login(self)
     time.sleep(2)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_project").click()
     pub.switchtoframe(self)
     #筛选状态为进行中的项目,撤销列表中的第一个项目
     driver.find_element_by_id("statusFilter").click()
     time.sleep(0.5)
     filt = driver.find_element_by_id("mainStatusChange")
     time.sleep(1)
     filt.find_element_by_xpath("//option[@value='0']").click()
     time.sleep(1)
     pro_name = driver.find_element_by_xpath("//td[3]/a")
     #pro_name.text
     pro_name.click()
     time.sleep(2)
     #点击撤销按钮
     driver.find_element_by_xpath("//div[3]/div/div[2]/span").click()
     time.sleep(2)
     cancelReason = driver.find_element_by_id("MgtPopup-Popup")
     cancelReason.find_element_by_id("reason").clear()
     cancelReason.find_element_by_id("reason").send_keys(u"项目需要撤销!")
     time.sleep(2)
     cancelReason.find_element_by_xpath("//input[@value='提交']").click()
     time.sleep(1)
     driver.find_element_by_id("mgtConfirmDivId").find_element_by_id("confirmOk").click()
     time.sleep(2)
     driver.find_element_by_id("mgtAlertDivId").find_element_by_id("buttonOk").click()
     time.sleep(1)
     print u"项目已撤销!"
     user.quit(self)
开发者ID:jmb-cd,项目名称:webcd_test,代码行数:35,代码来源:at_project1_status.py


示例10: test_task_03

 def test_task_03(self):
     '''发起讨论'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     sleep(1)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_task").click()
     sleep(1)
     pub.switchtoframe(self)
     driver.find_element_by_css_selector('td.ellipsis.ch').click()
     sleep(1)
     driver.find_element_by_xpath("//button[2]").click()
     sleep(1)
     driver.find_element_by_xpath('//input[@id="talkTitle"]').clear()
     driver.find_element_by_xpath('//input[@id="talkTitle"]').send_keys(u'新发起的讨论标题_%s'%pub.now())
     # print u'讨论发起成功!名称为:新发起的讨论标题_%s'%pub.now()
     sleep(0.5)
     driver.find_element_by_xpath('//*[@id="talkSubmit"]').click()
     sleep(0.5)
     popInfo = driver.find_element_by_xpath('//*[@id="notificationstop-center"]').text
     print u'提示信息:%s'%popInfo
     self.assertEqual(popInfo,u'创建成功','Test failed!!!')
     if popInfo == u'创建成功':
         print 'Test passed!'
     else:
         print 'Test failed!'
开发者ID:jmb-cd,项目名称:webcd_test,代码行数:27,代码来源:at_task.py


示例11: test_task_04

 def test_task_04(self):
     '''上传文档'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     sleep(1)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_task").click()
     sleep(1)
     pub.switchtoframe(self)
     driver.find_element_by_css_selector('td.ellipsis.ch').click()
     sleep(1)
     driver.find_element_by_xpath('//button[3]').click()
     sleep(0.5)
     driver.find_element_by_xpath('//*[@id="mgtfile"]').send_keys('D:\\work\\mgt_webtest\\data\\mobilebook.txt')
     sleep(0.5)
     driver.find_element_by_xpath('//*[@id="submitBtn"]').click()
     print u'上传文档成功!'
     sleep(0.5)
     popInfo = driver.find_element_by_xpath('//*[@id="notificationstop-center"]').text
     print u'提示信息:%s'%popInfo
     self.assertEqual(popInfo,u'上传成功','Test failed!!!')
     if popInfo == u'上传成功':
         print 'Test passed!'
     else:
         print 'Test failed!'
开发者ID:jmb-cd,项目名称:webcd_test,代码行数:26,代码来源:at_task.py


示例12: test_task_10

 def test_task_10(self):
     '''撤销及恢复任务'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     sleep(1)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_task").click()
     sleep(1)
     pub.switchtoframe(self)
     page_task.newTask(self)
     sleep(1)
     driver.find_element_by_xpath('//*[@id="taskList"]').click()
     sleep(1)
     driver.find_element_by_css_selector('td.ellipsis.ch').click()
     sleep(1)
     #撤销任务
     driver.find_element_by_xpath('//*[@id="taskRevokeBtn"]').click()
     sleep(2)
     driver.find_element_by_xpath('//*[@id="submitBtn"]').click()
     sleep(1)
     popInfo = driver.find_element_by_xpath('//*[@id="notificationstop-center"]').text
     print u'提示信息:%s'%popInfo
     #恢复任务
     driver.find_element_by_xpath('//*[@id="taskRecoverBtn"]').click()
     sleep(1)
     driver.find_element_by_xpath('//*[@id="okBtn"]').click()
     sleep(1)
     popInfo_1 = driver.find_element_by_xpath('//*[@id="notificationstop-center"]').text
     print u'提示信息:%s'%popInfo_1
     # self.assertEqual(popInfo_1,u'操作成功','Test failed!!!')
     if popInfo == u'操作成功':
         print 'Test passed!'
     else:
         print 'Test failed!'
开发者ID:jmb-cd,项目名称:webcd_test,代码行数:35,代码来源:at_task.py


示例13: test_task_02

 def test_task_02(self):
     '''添加事件'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     sleep(1)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_task").click()
     sleep(1)
     pub.switchtoframe(self)
     driver.find_element_by_css_selector('td.ellipsis.ch').click()
     sleep(1)
     driver.find_element_by_id('addAffairBtn').click()
     driver.find_element_by_xpath("//input[@id='taskAffairTitle']").clear()
     driver.find_element_by_xpath("//input[@id='taskAffairTitle']").send_keys(u'新建事件标题_%s'%pub.now())
     print u'新建事件成功!事件标题为:新建事件标题_%s'%pub.now()
     sleep(1)
     driver.find_element_by_xpath('//button[@id="addEventSubmitBtn"]').click()
     popInfo = driver.find_element_by_xpath('//*[@id="notificationstop-center"]').text
     print u'提示信息:%s'%popInfo
     self.assertEqual(popInfo,u'创建成功','Test failed!!!')
     if popInfo == u'创建成功':
         print 'Test passed!'
     else:
         print 'Test failed!'
开发者ID:jmb-cd,项目名称:webcd_test,代码行数:25,代码来源:at_task.py


示例14: test_notice_15

 def test_notice_15(self):
     '''重新投票'''
     driver = self.driver
     user.login(self)
     pub.equal(self)
     print driver.title
     page_notice.gotoNotice(self)
     driver.find_element_by_css_selector('div.list-title').click()
     sleep(1)
     try:
         driver.find_element_by_xpath("//div[@id='notice_detail_vote']/div[2]/div/div/label/div").click()
         sleep(1)
         driver.find_element_by_xpath('//div[3]/button').click()
         sleep(1)
         print u"投票成功!"
     except:
         print u"投票失败!"
     driver.find_element_by_xpath('//button[5]').click()
     sleep(1)
     driver.find_element_by_xpath('//div[2]/div[2]/div/button[2]').click()
     sleep(1)
     num = driver.find_element_by_xpath("//div[@id='notice_detail_vote']/div[1]/span[2]").text
     if int(num) == 0:
         print u'重新投票设置成功!'
     else:
         print u'重新投票设置失败!'
开发者ID:jmb-cd,项目名称:webcd_test,代码行数:26,代码来源:test_notice.py


示例15: test_task_06

 def test_task_06(self):
     '''任务总结'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     sleep(1)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_task").click()
     sleep(1)
     pub.switchtoframe(self)
     driver.find_element_by_css_selector('td.ellipsis.ch').click()
     sleep(1)
     driver.find_element_by_xpath('//*[@id="taskSummaryBtn"]').click()
     sleep(0.5)
     now = pub.now()
     driver.find_element_by_xpath('//div[@role="presentation"]/div/div').clear()
     driver.find_element_by_xpath('//div[@role="presentation"]/div/div').send_keys('task_summary_%s'%now)
     sleep(0.5)
     driver.find_element_by_xpath('//*[@id="submitBtn"]').click()
     sleep(0.5)
     taskSummary = driver.find_element_by_xpath('//div[@id="viewContent"]/table/tbody/tr[5]/td[2]/span/p').text
     print u'总结内容是:%s'%taskSummary
     self.assertEqual(taskSummary,'task_summary_%s'%now,'Test failed!!!')
     if taskSummary == 'task_summary_%s'%now:
         print 'Test passed!'
     else:
         print 'Test failed!'
开发者ID:jmb-cd,项目名称:webcd_test,代码行数:27,代码来源:at_task.py


示例16: test_mycomment_02

 def test_mycomment_02(self):
     '''编辑发出的评论'''
     driver = self.driver
     driver.get(self.base_url)     
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//li[4]/a/strong").click()
     time.sleep(2)
     self.assertEqual("我的评论",driver.find_element_by_xpath("/html/body/div/div/div[2]/div[1]/div/div/div/span").text)
     driver.find_element_by_xpath("//div[2]/div/div/ul/li[2]/a").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'编辑')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//*[@id='commentText']").clear()
     nowtime = time.ctime()
     driver.find_element_by_xpath("//*[@id='commentText']").send_keys(u"编辑发出的评论%s"%nowtime)
     #time.sleep(2)
     driver.find_element_by_xpath("//*[@id='editCommentOk']").click()
     time.sleep(2)
     self.assertEqual(u"编辑发出的评论%s"%nowtime,driver.find_element_by_xpath("/html/body/div/div/div[2]/div[2]/div/table/tbody/tr[1]/td/div[1]/span[1]").text)
     print u"修改成功!"
     user.quit(self)
开发者ID:zhoubin-20151109,项目名称:webcd_test,代码行数:26,代码来源:at_worklog4_mycomment.py


示例17: test_viewweekplan

 def test_viewweekplan(self):
     '''查看周计划'''
     driver = self.driver
     driver.get(self.base_url)# + "/mgt/frame.jsp?url=MGT_PLN")
     user.login(self)
     time.sleep(2)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_plan").click()
     time.sleep(2)
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//span[@id='realname']").click()
     time.sleep(1)
     #默认新建本周的计划,若已存在,则直接进入本周计划
     now_a = time.strftime('%Y-%m-%d_%H-%M-%S',time.localtime())
     
     try:            
         driver.find_element_by_xpath("//div[@id='weekInfo']/div/input").click()
     except:
         print u"计划不存在,无法查看,测试结束!"
     time.sleep(2)
     try:
         driver.find_element_by_name("modifyPlan").click()
     except:
         driver.find_element_by_name("modifyTitle").click()
         driver.find_element_by_id("planTitle").clear()
         driver.find_element_by_id("planTitle").send_keys(u"新计划标题:%s"%now_a)
         time.sleep(3)
         driver.find_element_by_xpath("//div[@id='hideTitleDiv']/span/input[2]").click()
         time.sleep(1)
         driver.find_element_by_xpath("//input[@value='立即发布当前计划']").click()
         driver.find_element_by_id("mgtConfirmDivId").find_element_by_id("confirmOk").click()
     print u"计划已发布!计划标题是:新计划标题:%s"%now_a
     time.sleep(1)
开发者ID:zhoubin-20151109,项目名称:webcd_test,代码行数:33,代码来源:at_plan.py


示例18: test_project_status_2

 def test_project_status_2(self):
     '''激活项目'''
     driver = self.driver
     driver.get(self.base_url)# + "/mgt/frame.jsp?url=MGT_PROJECT_MY")        
     user.login(self)
     time.sleep(2)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_project").click()
     pub.switchtoframe(self)
     #筛选状态为已完成的项目,撤销第一个项目
     driver.find_element_by_id("statusFilter").click()
     time.sleep(0.5)
     filt = driver.find_element_by_id("mainStatusChange")
     time.sleep(1)
     filt.find_element_by_xpath("//option[@value='2']").click()
     time.sleep(1)
     driver.find_element_by_xpath("//td[3]/a").click()
     time.sleep(2)
     #点击激活按钮
     driver.find_element_by_xpath("//div[2]/div/div[2]/span").click()
     time.sleep(2)
     actReason=driver.find_element_by_xpath("//*[@id='MgtPopup-Popup']")        
     actReason.find_element_by_xpath("//*[@id='reason']").clear()
     driver.find_element_by_xpath("//*[@id='reason']").send_keys(u"激活理由@%s"%time.ctime())
     print u"项目已激活成功!"
     time.sleep(2)
     actReason.find_element_by_xpath("//input[@value='提交']").click()
     time.sleep(1)
     driver.find_element_by_id("mgtConfirmDivId").find_element_by_id("confirmOk").click()
     time.sleep(2)
     driver.find_element_by_id("mgtAlertDivId").find_element_by_id("buttonOk").click()
     time.sleep(1)
     print u"项目已激活!"
     user.quit(self)
开发者ID:jmb-cd,项目名称:webcd_test,代码行数:34,代码来源:at_project1_status.py


示例19: test_viewlog_02

 def test_viewlog_02(self):
     '''编辑评阅日志'''
     driver = self.driver
     driver.get(self.base_url)     
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//li[5]/a/strong").click()
     time.sleep(2)
     self.assertEqual("评阅日志",driver.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[1]/div/span").text)
     driver.find_element_by_xpath("//div[@id='viewlogList']/table/tbody/tr/td/div").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'编辑')]").click()
     time.sleep(2)
     nowtime = time.ctime()
     driver.find_element_by_xpath("//*[@id='commentText']").clear()
     driver.find_element_by_xpath("//*[@id='commentText']").send_keys(u"编辑经理评阅日志@%s"%nowtime)
     print u"编辑评阅日志成功!编辑后的评论内容:编辑经理评阅日志@%s"%nowtime
     time.sleep(2)
     driver.find_element_by_xpath("//*[@id='editCommentOk']").click()
     time.sleep(2)
     self.assertEqual(u"编辑经理评阅日志@%s"%nowtime,driver.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[4]/div/div/div[6]/div/table/tbody/tr[2]/td").text)
     user.quit(self)
     driver.close()
开发者ID:zhoubin-20151109,项目名称:webcd_test,代码行数:27,代码来源:at_worklog5_viewlog.py


示例20: test_todaylog_05

 def test_todaylog_05(self):
     '''修改工作记录'''
     driver = self.driver
     driver.get(self.base_url)# + "/module/worklog/userfo.do?locale=zh_CN")        
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     try:
         driver.find_element_by_xpath("//td[3]/a/i").click()        
         time.sleep(1)
         #使用二次定位的方法找到对话框中的文本框
         div = driver.find_element_by_id("myModal").find_element_by_id("modalContent")
         nowtime = time.strftime("%Y_%m_%d-%H_%M_%S",time.localtime())
         div.clear()
         div.send_keys(u"第一个工作记录:%s"%nowtime)
         print u"修改成功!内容如下:今天的第一个工作记录:%s"%nowtime
         time.sleep(2)
         driver.find_element_by_id("btn_worklog_ok").click()
         time.sleep(2)
     except NoSuchElementException, e:
         print u"数据尚未创建!"
         return False
开发者ID:zhoubin-20151109,项目名称:webcd_test,代码行数:25,代码来源:at_worklog1_workloginfo.py



注:本文中的user.login函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python user.logout函数代码示例发布时间:2022-05-27
下一篇:
Python user.get_user函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap