Exemple #1
0
class ReportApi:
    def __init__(self, conf_path):
        self.session = Service().get_session(conf_path)

    def get_resp(self, dict_dict):
        return Service().get_resp(self.session, dict_dict)

    def get_region(self, data_dict):
        return self.session.post(data_dict['url'], data_dict['data'])

    def get_select_value(self, data_dict):
        return self.session.post(data_dict['url'], data_dict['data'])
Exemple #2
0
 def do_decode(self, driver, data_dic):
     self.click_decode_btton(driver)
     self.input_subcode(driver, data_dic["subcode"])
     self.click_subcode_confirm(driver)
     from selenium.webdriver.common.by import By
     if Service().is_element_exist(driver, By.CSS_SELECTOR, '.bootbox-body'):
         message = self.get_decode_message(driver)
         time.sleep(0.5)
         driver.find_element_by_css_selector('#secondPass-modal button[class="close"]').click()
         return message
     return None
    def test_longin(self, login_data):

        Login().do_login(self.driver, login_data)
        if Service.is_element_exist(self.driver, By.LINK_TEXT, '注销'):
            result = 'successful'
        elif '用户名不能为空' in Service.element_text(self.driver, By.ID, 'userNameMsg'):
            result = 'user_invalid'
        elif '密码不能为空' in Service.element_text(self.driver, By.ID, 'pwMsg'):
            result = 'password_invalid'
        elif '用户名或密码错误' in Service.element_text(self.driver, By.ID, 'pwMsg'):
            result = 'login-fail'
        else:
            result = 'login-fai_withNoMessage'
        # 出现错误将截图
        if result != login_data["expect"]:
            Service.get_error_png(self.driver)
        self.assertEqual(result, login_data["expect"])
Exemple #4
0
    def test_longin(self, uname, upass, verifycode, expect, tes_id):

        login_data = {
            "userName": uname,
            "userPass": upass,

        }
        Login().do_login(self.driver, login_data)
        if Service.is_element_exist(self.driver, By.LINK_TEXT, '注销'):
            result = 'successful'
        elif '用户名不能为空' in Service.element_text(self.driver, By.ID, 'userNameMsg'):
            result = 'user_invalid'
        elif '密码不能为空' in Service.element_text(self.driver, By.ID, 'pwMsg'):
            result = 'password_invalid'
        elif '用户名或密码错误' in Service.element_text(self.driver, By.ID, 'pwMsg'):
            result = 'login-fail'
        else:
            result = 'login-fai_withNoMessage'
        # 出现错误将截图
        if result != expect:
            Service.get_error_png(self.driver)
        self.assertEqual(result, expect)
Exemple #5
0
from selenium import webdriver
from selenium.webdriver.common.by import By

from woniuBoss.lib.login import Login
from woniuBoss.tools.service import Service
login_data = {"username":"******","password":"******"}
driver = webdriver.Chrome()
driver.get("http://192.168.114.220:8080/WoniuBoss2.5/")
Login().do_login(driver,login_data)
driver.get("http://192.168.114.220:8080/WoniuBoss2.5/resource")
# 获取下拉列表中的内容
Service().get_select_values(driver,By.ID,"poolSelect")

# 除去
# Service.remove_readonly(driver,'date1')
ele =driver.find_element_by_id('date1')
ele.send_keys('2020-02-02')
driver.find_element_by_css_selector("div.pull-right>button.btn-primary").click()
driver.find_element_by_css_selector('input[name="cus.name"]').send_keys('hello')
 def setUpClass(cls) -> None:
     conf_path = '../conf/base.json'
     cls.driver = Service.get_driver(conf_path)
     Service.open_page(cls.driver, conf_path)
Exemple #7
0
 def __init__(self, conf_path):
     self.session = Service().get_session(conf_path)
Exemple #8
0
 def get_resp(self, dict_dict):
     return Service().get_resp(self.session, dict_dict)
 def __init__(self, conf_data):
     self.session = Service.get_session(conf_data)
Exemple #10
0
 def select_status(self,driver,data_dic):
     student_status = driver.find_element_by_css_selector('.stuStatus')
     Service().select_by_name(student_status, data_dic['status'])
Exemple #11
0
 def select_orientation(self,driver,data_dic):
     student_orientation = driver.find_element_by_css_selector('.stu-orientation')
     Service().select_by_name(student_orientation, data_dic['orientation'])
Exemple #12
0
 def select_class(self, driver, data_dic):
     student_class = driver.find_element_by_css_selector('.stu-class')
     Service().select_by_name(student_class, data_dic['class'])
 def setUp(self) -> None:
     Login().do_login(self.driver, data_dic=login_data)
     time.sleep(0.5)
     Service().open_page(self.driver, conf_path, page='student')