Exemple #1
0
 def input_last_storetime(self, lasttime):
     last_storetime_element = UiUtil.find_elment("sales", "last_time")
     # 待封装;
     js = 'document.getElementById("laststoretime").removeAttribute("readonly")'
     self.driver.execute_script(js)
     # 待封装;
     UiUtil.input(last_storetime_element, lasttime)
Exemple #2
0
    def input_early_storetime(self, earlytime):
        early_storetime_element = UiUtil.find_elment("sales", 'early_time')

        js = 'document.getElementById("earlystoretime").removeAttribute("readonly")'
        self.driver.execute_script(js)

        UiUtil.input(early_storetime_element, earlytime)
Exemple #3
0
    def do_login_test(self, path, section,
                      option):  #根据路径打开的文件含有excel的地址信息,根据这个地址,再去打开excel文件、
        contents = FileUtil.get_test_info(
            path, section, option)  #三个参数,分别是含含有excel相关数据的存放地址,section和option值
        # print(contents)
        i = 0
        for content in contents:
            i = i + 1
            # 执行登录操作;
            Login(self.driver).do_login(content)
            #使用try抛出异常,去定位元素;
            try:
                logout_button_element = UiUtil.find_elment(
                    "login", 'logout_button')
                UiUtil.click(logout_button_element)
                print(f"第{i}次 登录成功")

            except:
                time.sleep(2)
                print(f"第{i}次 登录失败")
                self.driver.refresh()
Exemple #4
0
 def input_account(self, username):
     uname = UiUtil.find_elment('login','uname')
     UiUtil.input(uname, username)
Exemple #5
0
 def click_login_button(self):
     login_button = UiUtil.find_elment('login','login_button')
     UiUtil.click(login_button)
Exemple #6
0
 def input_verifycode(self, verifycode):
     vfcode = UiUtil.find_elment('login','vfcode')
     UiUtil.input(vfcode, verifycode)
Exemple #7
0
 def input_password(self, password):
     upass = UiUtil.find_elment('login','upass')
     UiUtil.input(upass, password)
Exemple #8
0
    def input_account(self, username):
        uname = UiUtil.find_elment('login','uname')
        UiUtil.input(uname, username)

    def input_password(self, password):
        upass = UiUtil.find_elment('login','upass')
        UiUtil.input(upass, password)

    def input_verifycode(self, verifycode):
        vfcode = UiUtil.find_elment('login','vfcode')
        UiUtil.input(vfcode, verifycode)

    def click_login_button(self):
        login_button = UiUtil.find_elment('login','login_button')
        UiUtil.click(login_button)

    def do_login(self, login_data):
        self.input_account(login_data['username'])
        self.input_password(login_data['password'])
        self.input_verifycode(login_data['verifycode'])
        self.click_login_button()

    #完成登录后需不需要点击注销;如果点击了怎么进行判断页面元素,



if __name__ == '__main__':
    driver = UiUtil.get_driver()
    login_data = {'username':'******', 'password':'******', 'verifycode':'0000'}
    Login(driver).do_login(login_data)
Exemple #9
0
 def click_search_button(self):
     search_button_element = UiUtil.find_elment("sales", "search_button")
     UiUtil.click(search_button_element)
Exemple #10
0
 def input_goodstype(self, type):
     serial_element = UiUtil.find_elment("sales", 'goods_type')
     #下拉框,只需要输入两个参数即可;
     UiUtil.select_by_text(serial_element, type)
Exemple #11
0
 def input_barcode(self, barcode):
     barcode_element = UiUtil.find_elment("sales", 'barcode')
     UiUtil.input(barcode_element, barcode)
Exemple #12
0
 def input_goodsname(self, name):
     goods_name_element = UiUtil.find_elment("sales", "goods_name")
     UiUtil.input(goods_name_element, name)
Exemple #13
0
 def input_goodsserial(self, serial):
     goods_serial_element = UiUtil.find_elment(
         "sales", "goods_serial")  #等写了框架,把信息写入inspector文件;
     UiUtil.input(goods_serial_element, serial)
Exemple #14
0
 def click_store_page(self):
     store_page_element = UiUtil.find_elment("sales", "store_page")
     UiUtil.click(store_page_element)