コード例 #1
0
# coding:utf-8
from selenium.webdriver.common.by import By
from common import config_manage
from common.sql_helper import Sql_Helper

leaguer_evel_loc = config_manage.get_yaml_page_loc(
    'leaguer_loc\\leaguer_level_loc.yaml')


class Leaguer_Level_Page():
    def __init__(self, Base_Page, test_data):
        self.base = Base_Page
        self.data = test_data
        self.sql_assert = Sql_Helper()

    def switch_in_leaguer_level_menu(self):
        self.base.click(By.XPATH, leaguer_evel_loc["会员菜单"])
        self.base.click(By.XPATH, leaguer_evel_loc["会员管理菜单"])
        self.base.wait(1)
        self.base.click(By.XPATH, leaguer_evel_loc["会员级别菜单"])
        self.base.switch_in_iframe(leaguer_evel_loc["右侧iframe"])
        self.base.wait(2)

    def click_add_btn(self):
        self.base.click(By.XPATH, leaguer_evel_loc["新增按键"])

    def input_info(self):
        self.base.input(By.XPATH, leaguer_evel_loc["级别名称"], self.data["级别名称"])
        self.base.clear_and_input(By.XPATH, leaguer_evel_loc["续期价格"],
                                  self.data["续期价格"])
        self.base.clear_and_input(By.XPATH, leaguer_evel_loc["补卡价格"],
コード例 #2
0
import selenium
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from common import config_manage
goodsyaml = config_manage.get_yaml_page_loc('goods_loc\\add_goods.yaml')


class add_goods():
    def __init__(self, Base_Page, test_data):
        self.Base_Page = Base_Page
        self.test_data = test_data

    def switch_goodsmenu(self):
        '''进入商品新增菜单'''
        self.Base_Page.click(By.XPATH, goodsyaml['商品'])
        self.Base_Page.click(By.XPATH, goodsyaml['商品管理'])
        self.Base_Page.wait(2)
        self.Base_Page.click(By.XPATH, goodsyaml['商品资料'])
        self.Base_Page.switch_in_iframe(goodsyaml['商品资料iframe'])

    def add_goods(self):
        '''新增商品'''
        self.Base_Page.click(By.XPATH, goodsyaml['新增'])
        self.Base_Page.click(By.XPATH, goodsyaml['零售商品'])
        self.Base_Page.input(By.XPATH, goodsyaml['商品名称'],
                             self.test_data['商品名称'])
        self.Base_Page.click(By.XPATH, goodsyaml['选择分类'])
        self.Base_Page.wait(1)
        self.Base_Page.click(By.XPATH, goodsyaml['商品分类'])
        self.Base_Page.input(By.XPATH, goodsyaml['商品价格'],
                             self.test_data['商品价格'])
コード例 #3
0
# coding:utf-8
from selenium.webdriver.common.by import By
from common import config_manage

online_loc = config_manage.get_yaml_page_loc('online_loc\\online_loc.yaml')


class Online_Page():
    def __init__(self, Base_Page, test_data):
        self.base = Base_Page
        self.data = test_data

    def switch_in_ykb_menu(self):
        self.base.click(By.XPATH, online_loc["线上页面"]["线上"])
        self.base.switch_in_iframe(online_loc["线上页面"]["线上渠道iframe"])
        self.base.wait(2)
        self.base.click(By.XPATH, online_loc["线上页面"]["线上渠道"])
        self.base.switch_out_iframe()
        self.base.switch_in_iframe(online_loc["线上页面"]["盈客宝管理iframe"])
        self.base.click(By.XPATH, online_loc["线上页面"]["盈客宝管理"])
コード例 #4
0
ファイル: login_page.py プロジェクト: goodboyxzmkk/youlebao
from selenium.webdriver.common.by import By
from common import config_manage
from po.pages.base_page import Base_Page

login_loc = config_manage.get_yaml_page_loc('login_loc.yaml')


class Login_Page():
    def __init__(self, base_page, test_data):
        if isinstance(base_page, Base_Page):
            self.base = base_page
        self.data = test_data

    def run_login(self):
        self.base.input(By.XPATH, login_loc['登录页面']['用户名'], self.data['用户名'])
        self.base.input(By.XPATH, login_loc['登录页面']['密码'], self.data['密码'])
        self.base.click(By.XPATH, login_loc['登录页面']['登录按键'])
        self.base.wait(2)
        if (self.data['登录成功'] == '是'):
            result = self.base.get_text(By.XPATH, login_loc['断言']['登录成功'])
        else:
            result = self.base.get_text(By.XPATH, login_loc['断言']['登录失败'])
        self.base.log.info("【实际结果】 :" + result)
        self.base.log.info("【预期结果】 :" + self.data['预期结果'])
        assert str(result).strip() == self.data['预期结果']
コード例 #5
0
from selenium.webdriver.common.by import By

from common import config_manage
from common.sql_helper import Sql_Helper
from po.pages.base_page import Base_Page

goods_category_loc = config_manage.get_yaml_page_loc("goods_loc\\goods_category_loc.yaml")


class Goods_Category_Page():
    '''商品分类'''

    def __init__(self, base_page, test_data):
        try:
            if isinstance(base_page, Base_Page):
                self.base = base_page
        except:
            self.base.log("base_page异常!")
        self.data = test_data
        self.sql_assert = Sql_Helper()

    def switch_in_goods_category_menu(self):
        self.base.wait(1)
        self.base.click(By.XPATH, goods_category_loc["商品菜单"])
        self.base.click(By.XPATH, goods_category_loc["商品管理菜单"])
        self.base.wait(1)
        self.base.click(By.XPATH, goods_category_loc["商品资料菜单"])
        self.base.switch_in_iframe(goods_category_loc["右侧iframe"])
        self.base.wait(2)

    def click_all_goods_list(self):