Exemple #1
0
class Logout(Login):
    url = '/'
    logout_data = testDataInfo('Logout')['Logout']
    logout_type = logout_data['logout_el'][1]['type']
    logout_value = logout_data['logout_el'][2]['value']
    checkinfo_type = logout_data['check_info'][1]['type']
    checkinfo_value = logout_data['check_info'][2]['value']

    def logout(self):
        el = self.find_element_(self.logout_type, self.logout_value)
        self.click_(el)

    def check_logout(self):
        el = self.find_element_(self.checkinfo_type, self.checkinfo_value)
        text = self.text_(el)
        return text
class TestBasePage(StartEnd):
    '''执行测试'''
    logger = get_log('test BasePage')
    data = testDataInfo('Basepage')['Basepage']

    def test_open_browser(self):  #打开浏览器
        driver = browser()
        self.logger.info("Start test_open_browser_")
        try:
            newspage = BasePage(driver)
            newspage.open_browser_()
            self.assertEqual(newspage.check_title(),
                             self.data['check_info'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("open browser is end")
            newspage.quit_browser_()
Exemple #3
0
class TestLoginOut(StartEnd):
    logger = get_log('test logout')
    data = testDataInfo('Logout')['Logout']

    def test_logout(self):
        self.logger.info("Start test logout")
        driver = browser()
        newspage = Logout(driver)
        newspage.open_browser_()
        newspage.login_page()
        try:
            newspage.logout()
            newspage.accept_()
            text = newspage.check_logout()
            self.assertEqual(text, self.data['assertvalue'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test logout is end")
            newspage.quit_browser_()
Exemple #4
0
class Register(Page):
    url = '/'
    data = testDataInfo('Register')['Register']

    #定义进入注册会员页面方法
    def load_member_center(self):  #进入会员中心页面
        try:
            el = self.find_element_(self.data['member_center'][1]['type'],
                                    self.data['member_center'][2]['value'])
            self.click_(el)
        except:
            raise TypeError("input is invalid")
        self.switch_new_window_()  #切换到当前页面,会员中心页面

    #定义进入注册普通会员页面方法
    def load_regular_member(self):  #进入会员中心>普通会员页面
        try:
            el = self.find_element_(
                self.data['regular_member']['next_step'][1]['type'],
                self.data['regular_member']['next_step'][2]['value'])
            self.click_(el)
        except:
            raise TypeError("input is  invalid")
        self.switch_new_window_()

    #进入注册企业会员页面方法
    def load_corporate_member(self):  #进入会员中心>企业会员页面
        try:
            ele1 = self.find_element_(
                self.data['corporate_member']['ele1'][1]['type'],
                self.data['corporate_member']['ele1'][2]['value'])
            self.click_(ele1)
            ele2 = self.find_element_(
                self.data['corporate_member']['next_step'][1]['type'],
                self.data['corporate_member']['next_step'][2]['value'])
            self.click_(ele2)
        except:
            raise TypeError("input is invalid")
        self.switch_new_window_()
Exemple #5
0
class TestNewsPage(StartEnd):
    logger = get_log("test news_page")
    data = testDataInfo('News')['News']

    def test_news_page(self):
        self.logger.info("Start test news_page")
        driver = browser()
        newspage = NewsPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            title = newspage.check_title()
            self.assertEqual(title, self.data['check_ma'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test news page is end")
            newspage.quit_browser_()

    def test_homenews_page(self):
        self.logger.info("Start test homenews_page")
        driver = browser()
        newspage = NewsPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['homenews_page']['homenews_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(
                title,
                self.data['homenews_page']['check_homenews'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test home news page is end")
            newspage.quit_browser_()

    def test_nationalnews_page(self):
        self.logger.info("Start test nationalnews_page")
        driver = browser()
        newspage = NewsPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['nationalnews_page']['nationalnews_status'][2]
                ['value'])
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['nationalnews_page']['check_nationalnews'][2]
                ['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test nation news page is end")
            newspage.quit_browser_()

    def test_disportnews_page(self):
        self.logger.info("Start test disportnews_page")
        driver = browser()
        newspage = NewsPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['disportnews_page']['disportnews_status'][2]
                ['value'])
            title = newspage.check_title()
            self.assertEqual(
                title,
                self.data['disportnews_page']['check_disportnews'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test disport news page is end")
            newspage.quit_browser_()

    def test_sportnews_page(self):
        self.logger.info("Start test sportnews_page")
        driver = browser()
        newspage = NewsPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['sportnews_page']['sportnews_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(
                title,
                self.data['sportnews_page']['check_sportnews'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test sport news page is end")
            newspage.quit_browser_()

    def test_recommandnews_page(self):
        self.logger.info("Start test recommandnews_page")
        driver = browser()
        newspage = NewsPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['recommandnews_page']['ele1'][1]['type'],
                self.data['recommandnews_page']['ele1'][2]['value'])
            newspage.click_(ele1)
            newspage.switch_new_window_()
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['recommandnews_page']['check_re'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test recommandnews page is end")
            newspage.quit_browser_()

    def test_lastfresh_page(self):
        self.logger.info("Start test lastfresh_page")
        driver = browser()
        newspage = NewsPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_elements_(
                self.data['lastfresh_page']['ele1'][1]['type'],
                self.data['lastfresh_page']['ele1'][2]['value'])[
                    self.data['lastfresh_page']['status'][2]['value']]
            newspage.click_(ele1)
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['lastfresh_page']['check_fresh'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test lastfresh_page is ok")
            newspage.quit_browser_()

    def test_hotclick_page(self):
        self.logger.info("Start test hotclick_page")
        driver = browser()
        newspage = NewsPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_elements_(
                self.data['hotclick_page']['ele1'][1]['type'],
                self.data['hotclick_page']['ele1'][2]['value'])[
                    self.data['hotclick_page']['status'][2]['value']]
            newspage.click_(ele1)
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['hotclick_page']['check_hot'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test hotclick_page is end")
            newspage.quit_browser_()
Exemple #6
0
class TestPicturech(StartEnd):
    logger=get_log("test Picturechannel_page")
    data=testDataInfo('Picturech')['Picturech']
    def test_picturech_page(self):
        self.logger.info("Start test picturech_page")
        driver=browser()
        newspage =Picturech(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(
            self.data['master_page'][1]['type'],
            self.data['master_page'][2]['value']
        )
        try:
            title=newspage.check_title()
            self.assertEqual(title,self.data['check_ma'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test picturech page is end")
            newspage.quit_browser_()

    def test_star_page(self):
        self.logger.info("Start test star_page ")
        driver = browser()
        newspage = Picturech(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(
            self.data['master_page'][1]['type'],
            self.data['master_page'][2]['value']
        )
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['star_page']['star_status'][2]['value']
            )
            title=newspage.check_title()
            self.assertEqual(title,self.data['star_page']['check_star'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test star page is end")
            newspage.quit_browser_()

    def test_nature_page(self):
        driver = browser()
        newspage = Picturech(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(
            self.data['master_page'][1]['type'],
            self.data['master_page'][2]['value']
        )
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['nature_page']['nature_status'][2]['value']
            )
            title = newspage.check_title()
            self.assertEqual(title, self.data['nature_page']['check_nature'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test nature page is end")
            newspage.quit_browser_()

    def test_animotion_page(self):
        self.logger.info("Start test animotion_page")
        driver = browser()
        newspage = Picturech(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(
            self.data['master_page'][1]['type'],
            self.data['master_page'][2]['value']
        )
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['animotion_page']['animotion_status'][2]['value']
            )
            title = newspage.check_title()
            self.assertEqual(title,self.data['animotion_page']['check_animotion'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test animotion page is end")
            newspage.quit_browser_()

    def test_recommand_page(self):
        self.logger.info("Start test recommand_page")
        driver = browser()
        newspage = Picturech(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(
            self.data['master_page'][1]['type'],
            self.data['master_page'][2]['value']
        )
        try:
            element = newspage.find_element_(
                self.data['recommand_page']['ele1'][1]['type'],
                self.data['recommand_page']['ele1'][2]['value']
            )
            newspage.click_(element)
            newspage.switch_new_window_()
            title = newspage.check_title()
            self.assertEqual(title,self.data['recommand_page']['check_re'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test recommandnef page is end")
            newspage.quit_browser_()

    def test_lastfresh_page(self):
        self.logger.info("Start test lastfresh_page")
        driver = browser()
        newspage = Picturech(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(
            self.data['master_page'][1]['type'],
            self.data['master_page'][2]['value']
        )
        try:
            element = newspage.find_element_(
                self.data['lastfresh_page']['ele1'][1]['type'],
                self.data['lastfresh_page']['ele1'][2]['value']
            )
            newspage.click_(element)
            title = newspage.check_title()
            self.assertEqual(title,self.data['lastfresh_page']['check_fresh'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test lastfresh_page is end")
            newspage.quit_browser_()

    def test_hotclick_page(self):
        self.logger.info("Start test hotclick_page")
        driver = browser()
        newspage = Picturech(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(
            self.data['master_page'][1]['type'],
            self.data['master_page'][2]['value']
        )
        try:
            element = newspage.find_element_(
                self.data['hotclick_page']['ele1'][1]['type'],
                self.data['hotclick_page']['ele1'][2]['value']
            )
            newspage.click_(element)
            title = newspage.check_title()
            self.assertEqual(title,self.data['hotclick_page']['check_hot'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test hotclick page is end")
            newspage.quit_browser_()
Exemple #7
0
class TestFlashch(StartEnd):
    logger = get_log("test Flashchannel_page")
    data = testDataInfo('Flashchannel')['Flashchannel']

    def test_flash_page(self):
        driver = browser()
        newspage = Flashch(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            title = newspage.check_title()
            self.assertEqual(title, self.data['check_ma'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test flash page is end")
            newspage.quit_browser_()

    def test_game_page(self):
        self.logger.info("Start test game_page")
        driver = browser()
        newspage = Flashch(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['game_page']['game_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(title,
                             self.data['game_page']['check_game'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test game page is end")
            newspage.quit_browser_()

    def test_music_page(self):
        self.logger.info("Start test music_page")
        driver = browser()
        newspage = Flashch(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['music_page']['music_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['music_page']['check_music'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test music page is end")
            newspage.quit_browser_()

    def test_recommand_page(self):
        self.logger.info("Start test recommand_page")
        driver = browser()
        newspage = Flashch(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['recommand_page']['ele1'][1]['type'],
                self.data['recommand_page']['ele1'][2]['value'])
            newspage.click_(ele1)
            newspage.switch_new_window_()
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['recommand_page']['check_re'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test recommandnee page is end")
            newspage.quit_browser_()

    def test_lastfresh_page(self):
        driver = browser()
        newspage = Flashch(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['lastfresh_page']['ele1'][1]['type'],
                self.data['lastfresh_page']['ele1'][2]['value'])
            newspage.click_(ele1)
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['lastfresh_page']['check_fresh'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test lastfresh_page is end")
            newspage.quit_browser_()

    def test_hotclick_page(self):
        self.logger.info("Start test hotclick")
        driver = browser()
        newspage = Flashch(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            element = newspage.find_element_(
                self.data['hotclick_page']['ele1'][1]['type'],
                self.data['hotclick_page']['ele1'][2]['value'])
            newspage.click_(element)
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['hotclick_page']['check_hot'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test hotnee page is end")
            newspage.quit_browser_()
Exemple #8
0
class TestShopPage(StartEnd):
    logger = get_log("test shop_page")
    data = testDataInfo('Shop')['Shop']

    def test_shop_page(self):
        self.logger.info("Start test shop_page")
        driver = browser()
        newspage = ShopPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            title = newspage.check_title()
            self.assertEqual(title, self.data['check_ma'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test shop page is end")
            newspage.quit_browser_()

    def test_digit_page(self):
        self.logger.info("Start test digit_page")
        driver = browser()
        newspage = ShopPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['digit_page']['digit_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['digit_page']['check_digit'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test digit page is end")
            newspage.quit_browser_()

    def test_dianqi_page(self):
        self.logger.info("Start test dianqi_page")
        driver = browser()
        newspage = ShopPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['dianqi_page']['dianqi_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['dianqi_page']['check_dianqi'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test dianqi page is end")
            newspage.quit_browser_()

    def test_pc_page(self):
        self.logger.info("Start test pc_page")
        driver = browser()
        newspage = ShopPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['pc_page']['pc_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(title,
                             self.data['pc_page']['check_pc'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test pc page is end")
            newspage.quit_browser_()

    def test_book_page(self):
        self.logger.info("Start test book_page")
        driver = browser()
        newspage = ShopPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['book_page']['book_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(title,
                             self.data['book_page']['check_book'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test book page is end")
            newspage.quit_browser_()

    def test_recommand_page(self):
        self.logger.info("Start test recommand_page")
        driver = browser()
        newspage = ShopPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['recommand_page']['ele1'][1]['type'],
                self.data['recommand_page']['ele1'][2]['value'])
            newspage.click_(ele1)
            newspage.switch_new_window_()
            title = newspage.check_title()
            self.assertEqual(
                title,
                self.data['recommand_page']['check_recommand'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test recommandned page is end")
            newspage.quit_browser_()

    def test_lastfresh_page(self):
        self.logger.info("Start test lastfresh_page")
        driver = browser()
        newspage = ShopPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['lastfresh_page']['ele1'][1]['type'],
                self.data['lastfresh_page']['ele1'][2]['value'])
            newspage.click_(ele1)
            title = newspage.check_title()
            self.assertEqual(
                title,
                self.data['lastfresh_page']['check_lastfresh'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test lastned page is end")
            newspage.quit_browser_()

    def test_hotclick_page(self):
        self.logger.info("Start test hotclick_page")
        driver = browser()
        newspage = ShopPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['hotclick_page']['ele1'][1]['type'],
                self.data['hotclick_page']['ele1'][2]['value'])
            newspage.click_(ele1)
            title = newspage.check_title()
            self.assertEqual(
                title,
                self.data['hotclick_page']['check_hotclick'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test hotned page is end")
            newspage.quit_browser_()
Exemple #9
0
class TestTvchannelPage(StartEnd):
    logger = get_log("test tvchannel_page")
    data = testDataInfo('TVchannel')['TVchannel']

    def test_tvchannel_page(self):
        self.logger.info("Start test tvchannel")
        driver = browser()
        newspage = TvchannelPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            title = newspage.check_title()
            self.assertEqual(title, self.data['check_ma'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test tvchannel page is end")
            newspage.quit_browser_()

    def test_actionvideo_page(self):
        self.logger.info("Start test actionvideo_page")
        driver = browser()
        newspage = TvchannelPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['actionvideo_page']['actionvideo_status'][2]
                ['value'])
            title = newspage.check_title()
            self.assertEqual(
                title,
                self.data['actionvideo_page']['check_actionvideo'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test action video page is end")
            newspage.quit_browser_()

    def test_lovevideo_page(self):
        self.logger.info("Start test lovevideo_page")
        driver = browser()
        newspage = TvchannelPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['lovevideo_page']['lovevideo_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(
                title,
                self.data['lovevideo_page']['check_lovevideo'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test lovevideo page is end")
            newspage.quit_browser_()

    def test_comedy_page(self):
        self.logger.info("Start test comedy_page")
        driver = browser()
        newspage = TvchannelPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['comedy_page']['comedy_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['comedy_page']['check_comedy'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test comedy page is end")
            newspage.quit_browser_()

    def test_sitcome_page(self):
        self.logger.info("Start test sitcome_page")
        driver = browser()
        newspage = TvchannelPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['sitcome_page']['sitcome_status'][2]['value'])
            newspage.wait_title(
                self.data['sitcome_page']['check_book'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['sitcome_page']['check_book'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test sitcome page is end")
            newspage.quit_browser_()

    def test_recommand_page(self):
        self.logger.info("Start test recommand_page")
        driver = browser()
        newspage = TvchannelPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['recommand_page']['ele1'][1]['type'],
                self.data['recommand_page']['ele1'][2]['value'])
            newspage.click_(ele1)
            newspage.switch_new_window_()
            title = newspage.check_title()
            self.assertEqual(
                title,
                self.data['recommand_page']['check_recommand'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("tesst recommandnec page is end")
            newspage.quit_browser_()

    def test_lastfresh_page(self):
        self.logger.info("Start test lastfresh_page")
        driver = browser()
        newspage = TvchannelPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['lastfresh_page']['ele1'][1]['type'],
                self.data['lastfresh_page']['ele1'][2]['value'])
            newspage.click_(ele1)
            title = newspage.check_title()
            self.assertEqual(
                title,
                self.data['lastfresh_page']['check_lastfresh'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test lastfresh_page is end")
            newspage.quit_browser_()

    def test_hotclick_page(self):
        self.logger.info("Start test hotclick_page")
        driver = browser()
        newspage = TvchannelPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['hotclick_page']['ele1'][1]['type'],
                self.data['hotclick_page']['ele1'][2]['value'])
            newspage.click_(ele1)
            title = newspage.check_title()
            self.assertEqual(
                title,
                self.data['hotclick_page']['check_hotclick'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("load hotnec page is ok")
            newspage.quit_browser_()
Exemple #10
0
class TestArticlePage(StartEnd):
    logger=get_log("test Articl_page")
    data=testDataInfo('Article')['Article']

    def test_article_page(self):
        self.logger.info("Start test article_page ")
        driver=browser()
        newspage =ArticlePage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(
            self.data['master_page'][1]['type'],
            self.data['master_page'][2]['value']
                                  )
        try:
            title=newspage.check_title()
            self.assertEqual(title,self.data['check_ma'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test article page is end")
            newspage.quit_browser_()

    def test_novel_page(self):
        self.logger.info("Start test novel ")
        driver = browser()
        newspage = ArticlePage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(
            self.data['master_page'][1]['type'],
            self.data['master_page'][2]['value']
                                  )
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['n_status'][2]['value']
                                    )
            title=newspage.check_title()
            self.assertEqual(title,self.data['check_nv'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test novel page is end")
            newspage.quit_browser_()

    def test_porse_page(self):
        self.logger.info("Start test porse_page")
        driver = browser()
        newspage = ArticlePage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(
            self.data['master_page'][1]['type'],
            self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['p_status'][2]['value']
                                    )
            title = newspage.check_title()
            self.assertEqual(title, self.data['check_pr'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test porse page is end")
            newspage.quit_browser_()

    def test_portry_page(self, n_status=2):
        self.logger.info("Start test portry")
        driver = browser()
        newspage = ArticlePage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(
            self.data['master_page'][1]['type'],
            self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['portry_status'][2]['value']
            )
            title = newspage.check_title()
            self.assertEqual(title,self.data['check_portry'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test poetry page is end")
            newspage.quit_browser_()
Exemple #11
0
class TestDownloadPage(StartEnd):
    logger = get_log("test download_page")
    data = testDataInfo('Download')['Download']

    def test_download_page(self):
        self.logger.info("Start test downloadpage")
        driver = browser()
        newspage = DownloadPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            title = newspage.check_title()
            self.assertEqual(title, self.data['check_ma'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test download page is end")
            newspage.quit_browser_()

    def test_sys_page(self):
        self.logger.info("Start test sys_page")
        driver = browser()
        newspage = DownloadPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['sye_page']['sys_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(title,
                             self.data['sye_page']['check_sys'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test sys news page is end")
            newspage.quit_browser_()

    def test_nettools_page(self):
        self.logger.info("Start test nettols")
        driver = browser()
        newspage = DownloadPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['nettools_page']['net_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['nettools_page']['check_net'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test nettools page is end")
            newspage.quit_browser_()

    def test_safetools_page(self):
        self.logger.info("Start test safetools_page")
        driver = browser()
        newspage = DownloadPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['safetools_page']['net_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['safetools_page']['check_safe'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test safetools news page is end")
            newspage.quit_browser_()

    def test_mediatools_page(self):
        self.logger.info("Start test mediatools_page")
        driver = browser()
        newspage = DownloadPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(
                self.data['part_page'][1]['type'],
                self.data['part_page'][2]['value'],
                self.data['mediatools_page']['media_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['mediatools_page']['check_media'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test sport mediatools page is end")
            newspage.quit_browser_()

    def test_recommand_page(self):
        self.logger.info("Start test recommand_page")
        driver = browser()
        newspage = DownloadPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['recommand_page']['ele1'][1]['type'],
                self.data['recommand_page']['ele1'][2]['value'])
            newspage.click_(ele1)
            newspage.switch_new_window_()
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['recommand_page']['check_re'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test recommandnewb page is end")
            newspage.quit_browser_()

    def test_lastfresh_page(self):
        self.logger.info("Start test lastfresh_page")
        driver = browser()
        newspage = DownloadPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['lastfresh_page']['ele1'][1]['type'],
                self.data['lastfresh_page']['ele1'][2]['value'])
            newspage.click_(ele1)
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['lastfresh_page']['check_fresh'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test lastfresh page is end")
            newspage.quit_browser_()

    def test_hotclick_page(self):
        self.logger.info("Start test hotclick_page")
        driver = browser()
        newspage = DownloadPage(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['hotclick_page']['ele1'][1]['type'],
                self.data['hotclick_page']['ele1'][2]['value'])
            newspage.click_(ele1)
            title = newspage.check_title()
            self.assertEqual(
                title, self.data['hotclick_page']['check_hot'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test hotclick page is end")
            newspage.quit_browser_()
Exemple #12
0
class TestRegister(StartEnd):
    '''注册操作方法'''
    logger = get_log("test register")
    data = testDataInfo('Register')['Register']

    #进入注册页
    def test_member_center(self):  #会员中心注册成功测试用例
        self.logger.info("Start test member_center")
        driver = browser()
        newspage = Register(driver)
        newspage.open_browser_()
        try:
            newspage.load_member_center()
            title = newspage.title_()
            self.assertEqual(title, self.data['check_member'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test member_center is end")
            newspage.quit_browser_()

    #普通会员注册
    def test_regular_register(self):  #普通会员注册成功测试用例
        self.logger.info("Start test regular member register")
        driver = browser()
        newspage = Register(driver)
        newspage.open_browser_()
        newspage.load_member_center()
        newspage.load_regular_member()
        try:
            ele1 = newspage.find_element_(
                self.data['regular_member']['username_loc'][1]['type'],
                self.data['regular_member']['username_loc'][2]['value'])
            newspage.send_keys_(ele1, get_userNameAndPassword())

            ele2 = newspage.find_element_(
                self.data['regular_member']['password_loc'][1]['type'],
                self.data['regular_member']['password_loc'][2]['value'])
            newspage.send_keys_(ele2, '123456')

            ele3 = newspage.find_element_(
                self.data['regular_member']['repassword_loc'][1]['type'],
                self.data['regular_member']['repassword_loc'][2]['value'])
            newspage.send_keys_(ele3, '123456')

            ele4 = newspage.find_element_(
                self.data['regular_member']['email_loc'][1]['type'],
                self.data['regular_member']['email_loc'][2]['value'])
            newspage.send_keys_(ele4, get_Email())

            ele5 = newspage.find_element_(
                self.data['regular_member']['truename_loc'][1]['type'],
                self.data['regular_member']['truename_loc'][2]['value'])
            newspage.send_keys_(ele5, '大王')
            ele6 = newspage.find_element_(
                self.data['regular_member']['qq_loc'][1]['type'],
                self.data['regular_member']['qq_loc'][2]['value'])
            newspage.send_keys_(ele6, '*****@*****.**')
            ele7 = newspage.find_element_(
                self.data['regular_member']['msn_loc'][1]['type'],
                self.data['regular_member']['msn_loc'][2]['value'])
            newspage.send_keys_(ele7, '*****@*****.**')
            ele8 = newspage.find_element_(
                self.data['regular_member']['tel_loc'][1]['type'],
                self.data['regular_member']['tel_loc'][2]['value'])
            newspage.send_keys_(ele8, '15621312123')
            ele9 = newspage.find_element_(
                self.data['regular_member']['ip_loc'][1]['type'],
                self.data['regular_member']['ip_loc'][2]['value'])
            newspage.send_keys_(ele9, '192.168.2.11')
            ele10 = newspage.find_element_(
                self.data['regular_member']['head_portrait'][1]['type'],
                self.data['regular_member']['head_portrait'][2]['value'])
            newspage.send_keys_(
                ele10, self.data['regular_member']['head_img'][2]['value'])
            ele11 = newspage.find_element_(
                self.data['regular_member']['address'][1]['type'],
                self.data['regular_member']['address'][2]['value'])
            newspage.send_keys_(ele11, '南京市江宁双龙大道')

            ele12 = newspage.find_element_(
                self.data['regular_member']['zip_code'][1]['type'],
                self.data['regular_member']['zip_code'][2]['value'])
            newspage.send_keys_(ele12, '212404')

            ele13 = newspage.find_element_(
                self.data['regular_member']['personal'][1]['type'],
                self.data['regular_member']['personal'][2]['value'])
            newspage.send_keys_(ele13, '这是我的个人简介')

            ele14 = newspage.find_element_(
                self.data['regular_member']['register'][1]['type'],
                self.data['regular_member']['register'][2]['value'])
            newspage.click_(ele14)
            newspage.wait_title('会员中心')
            title = newspage.title_()
            self.assertEqual(
                title,
                self.data['regular_member']['check_regular'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test regular member register is end")
            newspage.quit_browser_()

    #企业会员注册
    def test_corporate_register(self):  #企业会员注册成功测试用例
        self.logger.info("Start test corporate member register")
        driver = browser()
        newspage = Register(driver)
        newspage.open_browser_()
        newspage.load_member_center()
        newspage.load_corporate_member()
        try:
            ele1 = newspage.find_element_(
                self.data['corporate_member']['username_loc'][1]['type'],
                self.data['corporate_member']['username_loc'][2]['value'])
            newspage.send_keys_(ele1, get_userNameAndPassword())

            ele2 = newspage.find_element_(
                self.data['corporate_member']['password_loc'][1]['type'],
                self.data['corporate_member']['password_loc'][2]['value'])
            newspage.send_keys_(ele2, '123456')

            ele3 = newspage.find_element_(
                self.data['corporate_member']['repassword_loc'][1]['type'],
                self.data['corporate_member']['repassword_loc'][2]['value'])
            newspage.send_keys_(ele3, '123456')

            ele4 = newspage.find_element_(
                self.data['corporate_member']['email_loc'][1]['type'],
                self.data['corporate_member']['email_loc'][2]['value'])
            newspage.send_keys_(ele4, get_Email())

            ele5 = newspage.find_element_(
                self.data['corporate_member']['company_loc'][1]['type'],
                self.data['corporate_member']['company_loc'][2]['value'])
            newspage.send_keys_(ele5, '江苏神州信源')
            ele6 = newspage.find_element_(
                self.data['corporate_member']['truename_loc'][1]['type'],
                self.data['corporate_member']['truename_loc'][2]['value'])
            newspage.send_keys_(ele6, '王治本')
            ele7 = newspage.find_element_(
                self.data['corporate_member']['telname_loc'][1]['type'],
                self.data['corporate_member']['telname_loc'][2]['value'])
            newspage.send_keys_(ele7, '王导')

            ele8 = newspage.find_element_(
                self.data['corporate_member']['tel_loc'][1]['type'],
                self.data['corporate_member']['tel_loc'][2]['value'])
            newspage.send_keys_(ele8, '1543123123')

            ele9 = newspage.find_element_(
                self.data['corporate_member']['fax_loc'][1]['type'],
                self.data['corporate_member']['fax_loc'][2]['value'])
            newspage.send_keys_(ele9, '41231')

            ele10 = newspage.find_element_(
                self.data['corporate_member']['qq_loc'][1]['type'],
                self.data['corporate_member']['qq_loc'][2]['value'])
            newspage.send_keys_(ele10, '12345312')

            ele11 = newspage.find_element_(
                self.data['corporate_member']['msn_loc'][1]['type'],
                self.data['corporate_member']['msn_loc'][2]['value'])
            newspage.send_keys_(ele11, '*****@*****.**')

            ele12 = newspage.find_element_(
                self.data['corporate_member']['ip_loc'][1]['type'],
                self.data['corporate_member']['ip_loc'][2]['value'])
            newspage.send_keys_(ele12, '192.168.3.32')

            ele13 = newspage.find_element_(
                self.data['corporate_member']['head_portrait'][1]['type'],
                self.data['corporate_member']['head_portrait'][2]['value'])
            newspage.send_keys_(
                ele13, self.data['regular_member']['head_img'][2]['value'])

            ele14 = newspage.find_element_(
                self.data['corporate_member']['address'][1]['type'],
                self.data['corporate_member']['address'][2]['value'])
            newspage.send_keys_(ele14, '南京市江宁双龙大道')

            ele15 = newspage.find_element_(
                self.data['corporate_member']['zip_code'][1]['type'],
                self.data['corporate_member']['zip_code'][2]['value'])
            newspage.send_keys_(ele15, '212404')

            ele16 = newspage.find_element_(
                self.data['corporate_member']['personal'][1]['type'],
                self.data['corporate_member']['personal'][2]['value'])
            newspage.send_keys_(ele16, '这是我的个人简介')

            ele17 = newspage.find_element_(
                self.data['corporate_member']['register'][1]['type'],
                self.data['corporate_member']['register'][2]['value'])
            newspage.click_(ele17)
            newspage.wait_title('会员中心')
            title = newspage.title_()
            self.assertEqual(
                title,
                self.data['regular_member']['check_regular'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test regular member register is end")
            newspage.quit_browser_()
class TestCategroyMsg(StartEnd):
    logger = get_log("test categroy_msg_page")
    data = testDataInfo('Categroymsg')['Categroymsg']

    def test_categroymsg_page(self):
        self.logger.info("Start test categroymsg_page")
        driver = browser()
        newspage = CategroyMsg(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            title = newspage.check_title()
            self.assertEqual(title, self.data['check_ma'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test category msg page is end")
            newspage.quit_browser_()

    def test_house_page(self):
        driver = browser()
        newspage = CategroyMsg(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(self.data['part_page'][1]['type'],
                                    self.data['part_page'][2]['value'],
                                    self.data['h_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(title, self.data['check_h'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test house page is end")
            newspage.quit_browser_()

    def test_fleamall_page(self):
        driver = browser()
        newspage = CategroyMsg(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(self.data['part_page'][1]['type'],
                                    self.data['part_page'][2]['value'],
                                    self.data['fl_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(title, self.data['check_fl'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test fleamall page is end")
            newspage.quit_browser_()

    def test_citylife_page(self):
        driver = browser()
        newspage = CategroyMsg(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(self.data['part_page'][1]['type'],
                                    self.data['part_page'][2]['value'],
                                    self.data['city_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(title, self.data['check_city'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test citylife page is end")
            newspage.quit_browser_()

    def test_job_page(self):
        driver = browser()
        newspage = CategroyMsg(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            newspage.load_part_page(self.data['part_page'][1]['type'],
                                    self.data['part_page'][2]['value'],
                                    self.data['job_status'][2]['value'])
            title = newspage.check_title()
            self.assertEqual(title, self.data['check_job'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test job page is end")
            newspage.quit_browser_()

    def test_search(self):
        driver = browser()
        newspage = CategroyMsg(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(self.data['search'][1]['type'],
                                          self.data['search'][2]['value'])
            newspage.send_keys_(ele1, self.data['search_keys'][2]['value'])
            Select(
                newspage.find_element_(
                    self.data['selector'][1]['type'],
                    self.data['selector'][2]['value'])).select_by_value(
                        str(self.data['selector_value'][2]['value']))
            ele2 = newspage.find_element_(
                self.data['search_button'][1]['type'],
                self.data['search_button'][2]['value'])
            newspage.click_(ele2)
            newspage.switch_new_window_()
            title = newspage.title_()
            self.assertEqual(title, self.data['check_search'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test search is end ")
            newspage.quit_browser_()

    def test_addinfo(self):
        self.logger.info("Start test addinfo")
        driver = browser()
        newspage = CategroyMsg(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['addinfo']['ele1'][1]['type'],
                self.data['addinfo']['ele1'][2]['value'])
            newspage.click_(ele1)
            newspage.switch_new_window_()
            Select(
                newspage.find_element_(
                    self.data['addinfo']['ele2'][1]['type'],
                    self.data['addinfo']['ele2'][2]['value'])).select_by_value(
                        str(self.data['addinfo']['ele2_value'][2]['value']))
            ele3 = newspage.find_element_(
                self.data['addinfo']['ele3'][1]['type'],
                self.data['addinfo']['ele3'][2]['value'])
            newspage.click_(ele3)
            newspage.switch_new_window_()
            title = newspage.title_()
            self.assertEqual(title,
                             self.data['addinfo']['checkinfo1'][2]['value'])
            ele4 = newspage.find_element_(
                self.data['addinfo']['ele4'][1]['type'],
                self.data['addinfo']['ele4'][2]['value'])
            newspage.send_keys_(ele4,
                                self.data['addinfo']['content1'][2]['value'])
            ele5 = newspage.find_element_(
                self.data['addinfo']['ele5'][1]['type'],
                self.data['addinfo']['ele5'][2]['value'])
            newspage.send_keys_(ele5,
                                self.data['addinfo']['content2'][2]['value'])
            ele6 = newspage.find_element_(
                self.data['addinfo']['ele6'][1]['type'],
                self.data['addinfo']['ele6'][2]['value'])
            newspage.clear_(ele6)
            newspage.send_keys_(ele6,
                                self.data['addinfo']['content3'][2]['value'])
            ele7 = newspage.find_element_(
                self.data['addinfo']['ele7'][1]['type'],
                self.data['addinfo']['ele7'][2]['value'])
            newspage.click_(ele7)
            elem8 = newspage.find_element_(
                self.data['addinfo']['ele8'][1]['type'],
                self.data['addinfo']['ele8'][2]['value'])
            newspage.click_(elem8)
            ele9 = newspage.find_element_(
                self.data['addinfo']['ele9'][1]['type'],
                self.data['addinfo']['ele9'][2]['value'])
            self.assertTrue(ele9)
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test addinfo is end")
            newspage.quit_browser_()

    def test_areamap(self):
        self.logger.info("Start test areamap")
        driver = browser()
        newspage = CategroyMsg(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['areamap']['ele1'][1]['type'],
                self.data['areamap']['ele1'][2]['value'])
            newspage.click_(ele1)
            newspage.switch_new_window_()
            ele2 = newspage.find_element_(
                self.data['areamap']['ele2'][1]['type'],
                self.data['areamap']['ele2'][2]['value'])
            self.assertTrue(ele2)
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test areamap  is end ")
            newspage.quit_browser_()

    def test_house(self):
        driver = browser()
        newspage = CategroyMsg(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['house']['ele1'][1]['type'],
                self.data['house']['ele1'][2]['value'])
            newspage.click_(ele1)
            title = newspage.title_()
            self.assertEqual(title,
                             self.data['house']['check_info'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test house is end")
            newspage.quit_browser_()

    def test_pc(self):
        self.logger.info("Start test pc")
        driver = browser()
        newspage = CategroyMsg(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(self.data['pc']['ele1'][1]['type'],
                                          self.data['pc']['ele1'][2]['value'])
            newspage.click_(ele1)
            title = newspage.title_()
            self.assertEqual(title, self.data['pc']['check_info'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test pc is end")
            newspage.quit_browser_()

    def test_citylife(self):
        self.logger.info("Start test citylife")
        driver = browser()
        newspage = CategroyMsg(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['citylife']['ele1'][1]['type'],
                self.data['citylife']['ele1'][2]['value'])
            newspage.click_(ele1)
            title = newspage.title_()
            self.assertEqual(title,
                             self.data['citylife']['check_info'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test citylife is end")
            newspage.quit_browser_()

    def test_job(self):
        self.logger.info("Start test job")
        driver = browser()
        newspage = CategroyMsg(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(self.data['job']['ele1'][1]['type'],
                                          self.data['job']['ele1'][2]['value'])
            newspage.click_(ele1)
            title = newspage.title_()
            self.assertEqual(title, self.data['job']['check_info'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test job is end")
            newspage.quit_browser_()

    def test_hotclick(self):
        self.logger.info("Start test hotclick")
        driver = browser()
        newspage = CategroyMsg(driver)
        newspage.open_browser_()
        newspage.login_page()
        newspage.load_master_page(self.data['master_page'][1]['type'],
                                  self.data['master_page'][2]['value'])
        try:
            ele1 = newspage.find_element_(
                self.data['hotclick']['ele1'][1]['type'],
                self.data['hotclick']['ele1'][2]['value'])
            newspage.click_(ele1)
            title = newspage.title_()
            self.assertEqual(title,
                             self.data['hotclick']['check_info'][2]['value'])
        except Exception as msg:
            self.logger.error(msg)
            newspage.quit_browser_()
        finally:
            self.logger.info("test hotclick is end")
            newspage.quit_browser_()