def test_strategy_parity_case9(self):
     """净值归因"""
     strategy = StrategyParityModel(self.driver)
     strategy.execute_script_up()
     time.sleep(2)
     strategy.strategy_parity_attribution()
     # 断言,大类资产占比情况
     error_mes1 = strategy.find_element('xpath=>//*[@id="comment1"]').text
     error_mes = error_mes1.split(',')[0]
     try:
         assert error_mes == u'从仓位模拟结果来看'
         print('大类资产占比情况 pass')
     except Exception as e:
         print('大类资产占比情况 fail', format(e))
         print(error_mes)
     time.sleep(2)
     # 断言,风格因子占比情况
     error_mes1 = strategy.find_element('xpath=>//*[@id="comment2"]').text
     error_mes = error_mes1.split(',')[0]
     try:
         assert error_mes == u'在风格配置方面'
         print('风格因子占比情况 pass')
     except Exception as e:
         print('风格因子占比情况 fail', format(e))
         print(error_mes)
     time.sleep(2)
     # 断言,拟合优度
     error_mes1 = strategy.find_element(
         'xpath=>//*[@id="halfComment"]').text
     error_mes = error_mes1.split(',')[0]
     try:
         assert error_mes == u'回归结果显示'
         print('拟合优度 pass')
     except Exception as e:
         print('拟合优度 fail', format(e))
         print(error_mes)
     time.sleep(2)
 def test_strategy_parity_case91(self):
     """情景分析"""
     strategy = StrategyParityModel(self.driver)
     strategy.execute_script_up()
     time.sleep(2)
     strategy.strategy_parity_scene()
     '''压力测试'''
     # 断言,A股市场事件
     error_mes = strategy.find_element(
         'xpath=>//*[@id="stressTestTab"]/tbody/tr[2]/td[1]').text
     try:
         assert error_mes != u'--'
         print('A股市场事件 pass')
     except Exception as e:
         print('A股市场事件 fail', format(e))
         print(error_mes)
     time.sleep(2)
     # 断言,A股市场日期范围
     error_mes = strategy.find_element(
         'xpath=>//*[@id="stressTestTab"]/tbody/tr[2]/td[2]').text
     try:
         assert error_mes != u'--'
         print('A股市场日期范围 pass')
     except Exception as e:
         print('A股市场日期范围 fail', format(e))
         print(error_mes)
     time.sleep(2)
     # 断言,A股市场基金涨跌幅
     error_mes = strategy.find_element(
         'xpath=>//*[@id="stressTestTab"]/tbody/tr[2]/td[3]').text
     try:
         assert error_mes != u'--'
         print('A股市场基金涨跌幅 pass')
     except Exception as e:
         print('A股市场基金涨跌幅 fail', format(e))
         print(error_mes)
     time.sleep(2)
     # 断言,A股市场沪深300涨跌幅
     error_mes = strategy.find_element(
         'xpath=>//*[@id="stressTestTab"]/tbody/tr[2]/td[4]').text
     try:
         assert error_mes != u'--'
         print('A股市场沪深300涨跌幅 pass')
     except Exception as e:
         print('A股市场沪深300涨跌幅 fail', format(e))
         print(error_mes)
     time.sleep(2)
     # 债券固收市场
     strategy.find_element(
         'xpath=>//*[@id="incomeUl"]/li[2]').click()  # 点击债券固收市场
     time.sleep(3)
     # 断言,债券固收市场事件
     error_mes = strategy.find_element(
         'xpath=>//*[@id="stressTestTab"]/tbody/tr[2]/td[1]').text
     try:
         assert error_mes == u'土耳其货币危机'
         print('债券固收市场事件 pass')
     except Exception as e:
         print('债券固收市场事件 fail', format(e))
         print(error_mes)
     time.sleep(2)
     # 断言,债券固收市场日期范围
     error_mes = strategy.find_element(
         'xpath=>//*[@id="stressTestTab"]/tbody/tr[2]/td[2]').text
     try:
         assert error_mes == u'2018-08-10 - 2018-08-18'
         print('债券固收市场日期范围 pass')
     except Exception as e:
         print('债券固收市场日期范围 fail', format(e))
         print(error_mes)
     time.sleep(2)
     # 断言,债券固收市场基金涨跌幅
     error_mes = strategy.find_element(
         'xpath=>//*[@id="stressTestTab"]/tbody/tr[2]/td[3]').text
     try:
         assert error_mes != u'--'
         print('债券固收市场基金涨跌幅 pass')
     except Exception as e:
         print('债券固收市场基金涨跌幅 fail', format(e))
         print(error_mes)
     time.sleep(2)
     # 断言,债券固收市场沪深300涨跌幅
     error_mes = strategy.find_element(
         'xpath=>//*[@id="stressTestTab"]/tbody/tr[2]/td[4]').text
     try:
         assert error_mes != u'--'
         print('债券固收市场沪深300涨跌幅 pass')
     except Exception as e:
         print('债券固收市场沪深300涨跌幅 fail', format(e))
         print(error_mes)
     time.sleep(2)
     # 管理期货市场
     strategy.find_element(
         'xpath=>//*[@id="incomeUl"]/li[3]').click()  # 点击管理期货市场
     time.sleep(3)
     # 断言,管理期货市场事件
     error_mes = strategy.find_element(
         'xpath=>//*[@id="stressTestTab"]/tbody/tr[1]/td[1]').text
     try:
         assert error_mes == u'2018黑色系牛市'
         print('管理期货市场事件 pass')
     except Exception as e:
         print('管理期货市场事件 fail', format(e))
         print(error_mes)
     time.sleep(2)
     # 断言,管理期货市场日期范围
     error_mes = strategy.find_element(
         'xpath=>//*[@id="stressTestTab"]/tbody/tr[1]/td[2]').text
     try:
         assert error_mes == u'2018-07-26 - 2018-08-20'
         print('管理期货市场日期范围 pass')
     except Exception as e:
         print('管理期货市场日期范围 fail', format(e))
         print(error_mes)
     time.sleep(2)
     # 断言,管理期货市场基金涨跌幅
     error_mes = strategy.find_element(
         'xpath=>//*[@id="stressTestTab"]/tbody/tr[1]/td[3]').text
     try:
         assert error_mes != u'--'
         print('管理期货市场基金涨跌幅 pass')
     except Exception as e:
         print('管理期货市场基金涨跌幅 fail', format(e))
         print(error_mes)
     time.sleep(2)
     # 断言,基金涨跌幅沪深300涨跌幅
     error_mes = strategy.find_element(
         'xpath=>//*[@id="stressTestTab"]/tbody/tr[1]/td[4]').text
     try:
         assert error_mes != u'--'
         print('基金涨跌幅沪深300涨跌幅 pass')
     except Exception as e:
         print('基金涨跌幅沪深300涨跌幅 fail', format(e))
         print(error_mes)
     time.sleep(2)
     '''市道分析'''
     # 市道分析
     strategy.execute_script_down()  # 浏览器往下
     time.sleep(3)
     # 断言,市道分析
     error_mes = strategy.find_element(
         'xpath=>//*[@id="market-main-table"]/tbody/tr[1]/td[4]').text
     try:
         assert error_mes != u'--(0周)'
         print('市道分析 pass')
     except Exception as e:
         print('市道分析 fail', format(e))
         print(error_mes)
     time.sleep(2)
 def test_strategy_parity_case8(self):
     """持仓分析"""
     strategy = StrategyParityModel(self.driver)
     strategy.execute_script_up()
     time.sleep(2)
     strategy.strategy_parity_position()
     '''策略配置'''
     # 断言,期初净资产
     error_mes = strategy.find_element(
         'xpath=>//*[@id="policyTbl"]/tbody/tr[1]/td[2]').text
     try:
         assert error_mes != u'--'
         print('期初净资产 pass')
     except Exception as e:
         print('期初净资产 fail', format(e))
         print(error_mes)
     time.sleep(2)
     # 断言,资产占比
     error_mes = strategy.find_element(
         'xpath=>//*[@id="policyChart"]/div[1]/div[1]/div/span').text
     try:
         assert error_mes == u'资产占比'
         print('资产占比 pass')
     except Exception as e:
         print('资产占比 fail', format(e))
         print(error_mes)
     time.sleep(2)
     strategy.find_element(
         'xpath=>//*[@id="policyChart"]/div[2]/div[1]/div/button[2]').click(
         )  # 点击VaR贡献占比
     time.sleep(3)
     strategy.find_element(
         'xpath=>//*[@id="policyChart"]/div[2]/div[1]/div/button[3]').click(
         )  # 点击波动率贡献占比
     time.sleep(3)
     # 断言,子策略组合时序图
     error_mes = strategy.find_element(
         'xpath=>//*[@id="policyChart"]/div[3]/div[1]/div[1]/span').text
     try:
         assert error_mes == u'子策略组合时序图'
         print('子策略组合时序图 pass')
     except Exception as e:
         print('子策略组合时序图 fail', format(e))
         print(error_mes)
     time.sleep(2)
     '''策略相关性'''
     # 断言,策略相关性
     error_mes = strategy.find_element(
         'xpath=>//*[@id="headtMapdiv"]/div[1]/span').text
     try:
         assert error_mes == u'基金与指数滚动相关系数'
         print('策略相关性 pass')
     except Exception as e:
         print('策略相关性 fail', format(e))
         print(error_mes)
     time.sleep(2)
     # 市场指数
     strategy.find_element('xpath=>//*[@id="HS300"]').click()  # 点击沪深300
     time.sleep(3)
     strategy.find_element('xpath=>//*[@id="nanhuaShop"]').click()  # 点击南华商品
     time.sleep(3)
     # 策略指数
     strategy.find_element('xpath=>//*[@id="allMark"]').click()  # 点击私募全市场
     time.sleep(3)
     strategy.find_element(
         'xpath=>//*[@id="portfolioInvestment"]').click()  # 点击组合策略指数
     time.sleep(3)
     # 断言,策略相关性2
     error_mes = strategy.find_element(
         'xpath=>//*[@id="policyDependencies"]/div[3]/div[1]/span').text
     try:
         assert error_mes == u'子基金相关系数'
         print('策略相关性2 pass')
     except Exception as e:
         print('策略相关性2 fail', format(e))
         print(error_mes)
     time.sleep(2)
     # 统计区间
     strategy.find_element('xpath=>//*[@id="y1"]').click()  # 点击1Y
     time.sleep(5)