Exemplo n.º 1
0
 def __init__(self, driver):
     Page.__init__(self, driver)
     self.config_element = {
         "find_course": [
             "css",
             "#bs-example-navbar-collapse-1 > ul:nth-child(1) > li.all-discover-classify > a"
         ],
         "选择一个课程": ["css", 'h3.course-name>a'],
         "全文": [
             "css",
             'body > div:nth-child(11) > div > div.col-md-9 > div.panel.panel-default.course-detail > div > div.content > p > span'
         ],
         "收起": [
             'css',
             'body > div:nth-child(11) > div > div.col-md-9 > div.panel.panel-default.course-detail > div > div.content > div.more > p:nth-child(2) > span'
         ],
         "内容": [
             'css',
             'body > div:nth-child(11) > div > div.col-md-9 > div.panel.panel-default.course-detail > div > div.content > p'
         ],
         "教授": ['css', '#professor > div > div > div.title > div > h2'],
         "课程大纲": ['id', 'curriculum-outline-tab'],
         "课程大纲_a": ['css', '#curriculum-outline > div'],
         "助教": ['id', 'course-assistant-tab'],
         "评价": ['id', 'comment-tab'],
         "评价_a": [
             'css',
             '#comment > div.panel.panel-default.panel-comment > div > div.panel-left > div > p:nth-child(1)'
         ],
         "免费试听": ['id', 'free_listen_for_login'],
         "加入课程": [
             'css',
             'body > div:nth-child(11) > div > div.col-md-9 > div.panel.panel-default.course-detail > div > div.content > div.addenda.clearfix > div.text-right.fr > a.btn.btn-primary.loading.add_to_cart'
         ],
         "进入课程": [
             'css',
             'body > div:nth-child(11) > div > div.col-md-9 > div.panel.panel-default.course-detail > div > div.content > div.addenda.clearfix > div.text-right.fr > a'
         ],
         "即将开课": [
             'css',
             'body > div:nth-child(11) > div > div.col-md-9 > div.panel.panel-default.course-detail > div > div.content > div.addenda.clearfix > div.text-right.fr > a'
         ],
         "结束试听": [
             'css',
             'body > div:nth-child(11) > div > div.col-md-9 > div.panel.panel-default.course-detail > div > div.content > div.addenda.clearfix > div.text-right.fr > a.btn.btn-info.add_to_cart'
         ],
         "账号输入框": ["id", "login_user_email"],
         "密码输入框": ['id', "login_password"],
         "登录按钮": [
             'css',
             "body > div.company-login.login01 > div > div.login-panel-body > form > div.form-group.no-margin-bot > div > button"
         ],
         "课程更新信息": ["id", "msg-content-0"],
         "显示": ["css", 'button.toggle-visibility-button'],
         "隐藏": ["css", "button.toggle-visibility-button"],
         "第一章": [
             'css',
             '#main > div > div.info-wrapper > section.handouts > ul:nth-child(2) > li > a'
         ],
     }
Exemplo n.º 2
0
 def __init__(self, driver):
     Page.__init__(self, driver)
     self.config_element = {
         "选择一个课程": [
             'css',
             '#page1 > div > div > div > div.course-aside.panel-md > div.course-about > h3 > a'
         ],
         "已完成": ['css', '#myTabs > li:nth-child(2) > a'],
         "助教": ['xpath', '//*[@id="course_user_menu"]/a[3]'],
         "助教_已完成": ['css', '#myTabs > li:nth-child(2) > a'],
         "助教_已取消": ['xpath', '//*[@id="myTabs"]/li[3]'],
         "宝典": ['xpath', '//*[@id="course_user_menu"]/a[5]'],
         "宝典获取": ['id', 'tab1-tab'],
         "宝典支出": ['css', '#myTabs > li:nth-child(2)'],
         "转赠": [
             'css',
             'body > div:nth-child(11) > div.container > div > div.stay-r > div > div.panel-body.relate > div.book-recharge > button'
         ],
         "对方id": ['id', 'user_id'],
         "对方账号": ['id', 'phone_or_email'],
         "转赠宝典": ['id', 'max_score'],
         "转赠_关闭": [
             'css',
             'body > div:nth-child(11) > div.mask > div > div.popup-head > span'
         ],
         "宝典_确认": ['id', 'give_score'],
         "宝典_充值": [
             'css',
             'body > div:nth-child(11) > div.container > div > div.stay-r > div > div.panel-body.relate > div.book-recharge > a'
         ],
         "充值_确认": ['id', 'btn_subimit_coin'],
         "充值_数额": [
             'css',
             'body > div:nth-child(11) > div > div.stay-r > div > div > div > div:nth-child(1) > div > div.panel-heading > p:nth-child(2) > span > span'
         ],
         "充值宝典": [
             'css',
             'body > div:nth-child(11) > div > div.stay-r > div > div > div > div:nth-child(1) > div > div.panel-body > div > span:nth-child(2)'
         ],
         "总获得宝典": [
             'css',
             'body > div:nth-child(11) > div > div.stay-r > div > div > div > div:nth-child(1) > div > div.panel-body > div > span:nth-child(6)'
         ],
         "其他金额": ['id', 'coin_amount'],
         "申请开发票": [
             'css',
             'body > div:nth-child(11) > div > div.stay-r > div > div > div > div:nth-child(9) > div.for-bill > div > input'
         ],
         "申请开发票_l": [
             'css',
             'body > div:nth-child(11) > div > div.stay-r > div > div > div > div:nth-child(9) > div.panel.panel-default.form-panle.text-left.triangle.ask-invoice-detail'
         ],
         "账号输入框": ["id", "login_user_email"],
         "密码输入框": ['id', "login_password"],
         "登录按钮": [
             'css',
             "body > div.company-login.login01 > div > div.login-panel-body > form > div.form-group.no-margin-bot > div > button"
         ],
     }
Exemplo n.º 3
0
 def __init__(self, driver):
     Page.__init__(self, driver)
     self.config_element = {
         "账号输入框": ["id", "login_user_email"],
         "密码输入框": ['id', "login_password"],
         "登录按钮": [
             'css',
             "body > div.company-login.login01 > div > div.login-panel-body > form > div.form-group.no-margin-bot > div > button"
         ],
         "登录错误提示": ['id', 'show_error'],
         "忘记密码": ['id', 'forget_password'],
         "验证码登录": [
             'css',
             'body > div.company-login.login01 > div > div.login-panel-body > form > div.tips > div > a.pull-right.code-btn'
         ],
         "账号密码登录": ['id', 'accout-login'],
         "中英文切换":
         ['css', 'body > div.language > ul > li.language-active > a'],
         "英文": ['linktext', 'English'],
         "中文": ['linktext', '中文'],
         "个人资料入口": ['css', '#hover-drop > a > img'],
         "个人资料": ['css', '#hover-drop > ul > li:nth-child(2) > a'],
         "添加新地址": ['css', '#tab3 > div > div > div > button'],
         "账号安全": ['css', '#myTabs > li.active'],
         "绑定邮箱": ['id', 'click_change_email'],
         "邮件_密码输入框": ['id', 'email_oldpassword'],
         "修改邮箱": ['id', 'new_email'],
         "发送邮件": ['id', 'send_email'],
         "邮箱_取消": ['css', '#cancel_email_send > div > input'],
         "邮箱密码_错误提示": ['id', 'email_oldpassword-error'],
         "邮箱_错误": ['id', 'new_email-error'],
         "修改手机": ['id', 'click_change_mobile'],
         "修改手机_old": ['id', 'phone_oldpassword'],
         "修改手机_手机号码": ['id', 'mobile'],
         "修改手机_弹窗": ['css', '#layui-layer10 > div.layui-layer-btn > a'],
         "手机_获取验证码": ['id', 'get_verification_code'],
         "修改手机提交": ['id', 'submit_change_mobile'],
         "手机_取消": [
             'css',
             '#now_change_phone > div:nth-child(4) > div > input.btn.btn-primary.cancel-change'
         ],
         "重置密码": ['id', 'click_change_password'],
         "原密码输入框": ['id', 'psw-old'],
         "原密码错误提示": ['id', 'psw-old-error'],
         "新密码": ['id', 'change_psw1'],
         "新密码错误提示": ['id', 'change_psw1-error'],
         "确认密码输入框": ['id', 'change_psw2'],
         "确认密码错误提示": ['id', 'change_psw2-error'],
         "修改密码提交": ['id', 'submit_change_password'],
         "修改密码取消": [
             'css',
             '#now_change_password > div:nth-child(4) > div > input.btn.btn-primary.cancel-change'
         ],
         "邮件发送成功": ['id', 'email_send_sucess'],
         "修改密码x": ['css', '#layui-layer1 > span > a'],
         "退出": ['css', '#hover-drop > ul > li:nth-child(7) > a'],
         "修改密码提示": ['css', '#layui-layer1 > div.layui-layer-content'],
     }
Exemplo n.º 4
0
 def __init__(self, driver):
     Page.__init__(self, driver)
     self.config_element = {
         "地址管理": ['css', '#myTabs > li:nth-child(3) > a'],
         "个人资料入口": ['css', '#hover-drop > a > img'],
         "个人资料": ['css', '#hover-drop > ul > li:nth-child(2) > a'],
         "添加新地址": ['css', '#tab3 > div > div > div > button'],
         "收件人姓名": ['id', 'consignee'],
         "收件人手机号码": ['id', 'consignee_tel'],
         "选择省": ['id', 'province'],
         "广东": ['css', '#province > option:nth-child(20)'],
         "选择市": ['id', 'city'],
         "深圳": ['css', '#city > option:nth-child(4)'],
         "选择区": ['id', 'district'],
         "南山": ['css', '#district > option:nth-child(4)'],
         "提交": ["id", 'btn-submit'],
         "右上角x": [
             "css",
             'body > div:nth-child(11) > div.mask.mask_address > div > div.popup-head > span.close.fa.fa-times'
         ],
         "地址错误信息": ['id', 'consignee-error'],
         "手机号码错误信息": ['id', 'consignee_tel-error'],
         "详细地址错误信息": ['id', 'address-error'],
         "详细地址": ['id', 'address'],
         "编辑地址": [
             'css',
             '#tab3 > div > div > div:nth-child(5) > div > span.right-btm > span'
         ],
         "地址信息": [
             'css',
             '#tab3 > div > div > div:nth-child(5) > div > div:nth-child(1) > div > p'
         ],
         "地址div": ['css', 'div.section'],
         "设置为默认": ['css', 'span.link.set-default'],
         "默认": [
             'css',
             '#tab3 > div > div > div:nth-child(5) > p > span:nth-child(1)'
         ],
         "忘记密码": ['id', 'forget_password'],
         "验证码登录": [
             'css',
             'body > div.company-login.login01 > div > div.login-panel-body > form > div.tips > div > a.pull-right.code-btn'
         ],
         "账号密码登录": ['id', 'accout-login'],
         "账号输入框": ["id", "login_user_email"],
         "密码输入框": ['id', "login_password"],
         "登录按钮": [
             'css',
             "body > div.company-login.login01 > div > div.login-panel-body > form > div.form-group.no-margin-bot > div > button"
         ],
     }
Exemplo n.º 5
0
 def __init__(self,driver):
     Page.__init__(self,driver)
     self.config_element = {
         "账号输入框": ["id", "login_user_email"],
         "密码输入框": ['id', "login_password"],
         "登录按钮": ['css', "body > div.company-login.login01 > div > div.login-panel-body > form > div.form-group.no-margin-bot > div > button"],
         "登录错误提示": ['id', 'show_error'],
         "忘记密码": ['id', 'forget_password'],
         "验证码登录": ['css', 'body > div.company-login.login01 > div > div.login-panel-body > form > div.tips > div > a.pull-right.code-btn'],
         "账号密码登录": ['id', 'accout-login'],
         "中英文切换": ['css', 'body > div.language > ul > li.language-active > a'],
         "英文": ['linktext', 'English'],
         "中文": ['linktext', '中文'],
     }
Exemplo n.º 6
0
 def __init__(self, driver):
     Page.__init__(self, driver)
     self.config_element = {
         "app下载": [
             'css',
             '#bs-example-navbar-collapse-1 > ul:nth-child(1) > li:nth-child(4) > a'
         ],
         "立即下载": [
             'css',
             'body > div.app-download-banner > div.container > div.app-download-text > div > a'
         ],
         "有效管理": [
             'css',
             'body > div.container > div > div > ul > li:nth-child(1) > p:nth-child(3)'
         ],
         "及时关注": [
             'css',
             'body > div.container > div > div > ul > li:nth-child(2) > p:nth-child(3)'
         ],
         "节奏自掌控": [
             'css',
             'body > div.container > div > div > ul > li:nth-child(3) > p:nth-child(3)'
         ],
         "随堂小测": [
             'css',
             'body > div.container > div > div > ul > li:nth-child(4) > p:nth-child(3)'
         ],
         "直播讲座": [
             'css',
             'body > div.container > div > div > ul > li:nth-child(5) > p:nth-child(3)'
         ],
         "生动体验": [
             'css',
             'body > div.container > div > div > ul > li:nth-child(6) > p:nth-child(3)'
         ],
         "图片": [
             'css',
             'div.mytips:nth-child(1) > object:nth-child(1) > a:nth-child(1) > img:nth-child(1)'
         ],
         "账号输入框": ["id", "login_user_email"],
         "密码输入框": ['id', "login_password"],
         "登录按钮": [
             'css',
             "body > div.company-login.login01 > div > div.login-panel-body > form > div.form-group.no-margin-bot > div > button"
         ],
     }
Exemplo n.º 7
0
 def __init__(self, driver):
     Page.__init__(self, driver)
     self.config_element = {
         '账号输入': [
             'css',
             '#app > div.container > div:nth-child(1) > div.up-layer > div:nth-child(2) > input'
         ],
         '密码输入': [
             'css',
             '#app > div.container > div:nth-child(1) > div.up-layer > div:nth-child(3) > input'
         ],
         '确认': [
             'css',
             '#app > div.container > div:nth-child(1) > div.up-layer > div:nth-child(4) > button'
         ],
         '输入': ['css', '#mywords'],
         'send': ['id', 'jssend'],
     }
Exemplo n.º 8
0
 def test_login6(self):
     '''普通管理员登录'''
     self.user_login_verify(username="******", password="******")
     po = login(self.driver)
     now_url = self.driver.current_url
     self.assertEqual(Page.on_page(self.driver),
                      "http://admin.muggle-inc.com/desktop")
     #self.assertEqual(now_url,"http://admin.muggle-inc.com/desktop")
     #	self.assertEqual(po.pwd_error_hint(),'密码不能小于5位')
     function.insert_img(self.driver, 'user_success.png')
Exemplo n.º 9
0
 def __init__(self,driver):
     Page.__init__(self,driver)
     self.config_element = {
         "账号输入框": ["id", "login_user_email"],
         "密码输入框": ['id', "login_password"],
         "登录按钮": ['css', "body > div.company-login.login01 > div > div.login-panel-body > form > div.form-group.no-margin-bot > div > button"],
         "登录错误提示": ['id', 'show_error'],
         "忘记密码": ['id', 'forget_password'],
         "验证码登录": ['css', 'body > div.company-login.login01 > div > div.login-panel-body > form > div.tips > div > a.pull-right.code-btn'],
         "账号密码登录": ['id', 'accout-login'],
         "中英文切换": ['css', 'body > div.language > ul > li.language-active > a'],
         "英文": ['linktext', 'English'],
         "中文": ['linktext', '中文'],
         '错误': ['id', 'part1_err_msg'],
         '提交': ['id', 'btn_account_submit'],
         '手机&邮箱': ['id', 'account'],
         '忘记_手机': ['xpath', '/html/body/div[2]/div/div[2]/form/div[1]/div/input'],
         '忘记_验证码': ['xpath', '/html/body/div[2]/div/div[2]/form/div[2]/div/button'],
         '验证_error': ['id', 'show_code_error'],
     }
Exemplo n.º 10
0
 def __init__(self, driver):
     Page.__init__(self, driver)
     self.config_element = {
         "账号输入框": ["id", "login_user_email"],
         "密码输入框": ['id', "login_password"],
         "登录按钮":
         ['xpath', "/html/body/div[1]/div[2]/div/div[2]/div/form/button"],
         "登录错误提示": ['id', 'login_msg'],
         "忘记密码": ['id', 'forget_password'],
         "验证码登录": [
             'css',
             'body > div.company-login.login01 > div > div.login-panel-body > form > div.tips > div > a.pull-right.code-btn'
         ],
         "账号密码登录": ['id', 'accout-login'],
         "中英文切换":
         ['css', 'body > div.language > ul > li.language-active > a'],
         "英文": ['linktext', 'English'],
         "中文": ['linktext', '中文'],
         "登录按钮_1":
         ['xpath', '/html/body/nav/div/div[2]/ul[3]/li[1]/button']
     }
Exemplo n.º 11
0
 def tearDown(self):
     page = Page(self.driver)
     page.logout()
     self.assertEqual([], self.verificationErrors)
Exemplo n.º 12
0
 def test_recommended_topics(self):
     """主页所有推荐话题超链接”"""
     pg = Page(self.driver)
     pg.open()
     links_loc = (By.XPATH, "//div[@class='title']/a ")
     links = pg.find_elements(*links_loc)
     print("首页一共有%s个链接" % len(links))
     for i in range(len(links)):
         home_page_handle = pg.get_current_window_handle()
         link_title1 = links[i].text
         print(link_title1)
         links[i].click()
         time.sleep(1)
         all_handles = pg.get_window_handles()
         pg.switch_to_window(all_handles[1])
         time.sleep(1)
         link_title2 = pg.get_title()
         print(link_title2)
         try:
             self.assertIn(link_title1, link_title2)
             print("It's right ! ")
         except Exception as e:
             print("Failed !")
         pg.close()
         pg.switch_to_window(all_handles[0])
         time.sleep(1)
Exemplo n.º 13
0
 def __init__(self, driver):
     Page.__init__(self, driver)
     self.config_element = {
         "账号输入框": ["id", "login_user_email"],
         "密码输入框": ['id', "login_password"],
         "登录按钮": [
             'css',
             "body > div.company-login.login01 > div > div.login-panel-body > form > div.form-group.no-margin-bot > div > button"
         ],
         "登录错误提示": ['id', 'show_error'],
         "忘记密码": ['id', 'forget_password'],
         "验证码登录": [
             'css',
             'body > div.company-login.login01 > div > div.login-panel-body > form > div.tips > div > a.pull-right.code-btn'
         ],
         "账号密码登录": ['id', 'accout-login'],
         "中英文切换":
         ['css', 'body > div.language > ul > li.language-active > a'],
         "英文": ['linktext', 'English'],
         "中文": ['linktext', '中文'],
         "find_course": [
             "css",
             "#bs-example-navbar-collapse-1 > ul:nth-child(1) > li.all-discover-classify > a"
         ],
         "选择一个课程": ["css", 'h3.course-name>a'],
         "全文": [
             "css",
             'body > div:nth-child(11) > div > div.col-md-9 > div.panel.panel-default.course-detail > div > div.content > p > span'
         ],
         "收起": [
             'css',
             'body > div:nth-child(11) > div > div.col-md-9 > div.panel.panel-default.course-detail > div > div.content > div.more > p:nth-child(2) > span'
         ],
         "内容": [
             'css',
             'body > div:nth-child(11) > div > div.col-md-9 > div.panel.panel-default.course-detail > div > div.content > p'
         ],
         "教授": ['css', '#professor > div > div > div.title > div > h2'],
         "课程大纲": ['id', 'curriculum-outline-tab'],
         "课程大纲_a": ['css', '#curriculum-outline > div'],
         "助教": ['id', 'course-assistant-tab'],
         "评价": ['id', 'comment-tab'],
         "评价_a": [
             'css',
             '#comment > div.panel.panel-default.panel-comment > div > div.panel-left > div > p:nth-child(1)'
         ],
         "免费试听": ['id', 'free_listen_for_login'],
         "加入课程": [
             'css',
             'body > div:nth-child(11) > div > div.col-md-9 > div.panel.panel-default.course-detail > div > div.content > div.addenda.clearfix > div.text-right.fr > a.btn.btn-primary.loading.add_to_cart'
         ],
         "进入课程": [
             'css',
             'body > div:nth-child(11) > div > div.col-md-9 > div.panel.panel-default.course-detail > div > div.content > div.addenda.clearfix > div.text-right.fr > a'
         ],
         "即将开课": [
             'css',
             'body > div:nth-child(11) > div > div.col-md-9 > div.panel.panel-default.course-detail > div > div.content > div.addenda.clearfix > div.text-right.fr > a'
         ],
         "结束试听": [
             'css',
             'body > div:nth-child(11) > div > div.col-md-9 > div.panel.panel-default.course-detail > div > div.content > div.addenda.clearfix > div.text-right.fr > a.btn.btn-info.add_to_cart'
         ],
         "发现课程": [
             'css',
             '#bs-example-navbar-collapse-1 > ul:nth-child(1) > li.all-discover-classify > a'
         ],
         "课程": ['css', 'li.tab:nth-child(2) > a:nth-child(1)'],
         "笔记": [
             'css',
             '#content > div.aside-btn > div.note-btn.show-note-popup.ta-btn'
         ],
         "咨询": ['id', 'add_new_consult'],
         "写评论": ['id', 'add_comment'],
         "评论tab": ['css', '#comment_tag>.btn.btn-default'],
         "评论内容": ['id', 'comment_content'],
         "评论提交": ['id', 'btn_submit'],
         "评论标签": [
             'css',
             '#comment_list>.panel.panel-default.user-comment>.panel-body>.comment-body.clearfix>.content-label>.btn.btn-default'
         ],
         "提交确认": ['css', '.layui-layer-btn0'],
         "播放按钮": [
             'css',
             '#video_6644eb6158544b8588565f40ada89750 > div.tc-wrapper > div > div.video-controls > div:nth-child(2) > div.vcr > button'
         ],
         "视屏进度": [
             'css',
             '#video_6644eb6158544b8588565f40ada89750 > div.tc-wrapper > div > div.video-controls > div:nth-child(2) > div.vcr > div'
         ],
     }