예제 #1
0
 def loggin(self):
     log.info('==========登陆浏览器===========')
     self.driver.get('http://192.168.1.84:4200')
     self.driver.maximize_window()
     log.info('===========输入账号密码==============')
     self.send_keys(self.loc_name, data['name'])
     self.send_keys(self.loc_pwd, data['password'])
     self.click(self.loc_button)
예제 #2
0
 def test3(self):
     '''正常用户登陆'''
     log.info('===============test3正常用户登陆=====================')
     self.open.loggin()
     sleep(3)
     tt = "吴大胜6666"
     self.assertTrue(tt)
     log.info('==========用户正常登陆成功===========')
예제 #3
0
 def test2(self):
     ''' 账号密码为空 '''
     log.info('============test2账号密码为空==================')
     self.open.loggin_button()
     t3 = "请输入用户名!"
     t4 = "请输入密码!"
     verify1 = self.open.loggin_bug3(t3)
     verify2 = self.open.loggin_bug1(t4)
     self.assertTrue(verify1)
     log.info('=========错误用户名提示验证成功============')
     self.assertTrue(verify2)
예제 #4
0
 def test1(self):
     '''错误账号密码'''
     log.info('===========test1错误账号密码===============')
     self.open.loggin_name()
     self.open.loggin_pwd()
     self.open.loggin_button()
     log.info('============验证提示信息==========')
     t1 = "无此用户信息或是密码错误"
     verify = self.open.loggin_bug2(t1)
     self.assertTrue(verify)
     log.info('==========判断成功================')
예제 #5
0
 def loggin_button(self):
     log.info('=============点击登陆=================')
     self.click(self.loc_button)
예제 #6
0
 def loggin_pwd(self):
     log.info('============输入密码================')
     self.send_keys(self.loc_pwd, data['pwd'])
예제 #7
0
 def loggin_name(self):
     log.info('===========输入账号==============')
     self.send_keys(self.loc_name, data['names'])
예제 #8
0
 def loggin_open(self):
     log.info('==========登陆浏览器===========')
     self.driver.get('http://192.168.1.84:4200')
     self.driver.maximize_window()
예제 #9
0
파일: base.py 프로젝트: wudasheng/test_wu
            result = WebDriverWait(self.driver, self.timeout,
                                   self.t).until(EC.alert_is_present())
            return result
        except:
            return False

    def data(self, get_cwd):

        file_path = get_cwd() + r'\data_login.yaml'
        f = open(file_path, 'rb')
        y = self.yaml.load(f)  # 采用load方法读取yaml的文件内容,以json格式展示
        return y


if __name__ == "__main__":
    log.info("打开浏览器")
    driver = webdriver.Chrome()
    driver.get("http://192.168.1.84:4200")
    anjia = Base(driver)
    # locl = (By.XPATH, '//input')
    # loc2 = (By.XPATH, '//input[@type="password"]')
    # loc3 = (By.XPATH, '//button[contains(.,"登录")]')
    # loc4 = (By.XPATH, '//a[contains(text(),"忘记密码")]')
    # file_path = os.path.dirname(os.path.abspath(__file__)) + r'\data_login.yaml'
    # file_path = get_cwd() + r'\data_login.yaml'
    # print(file_path)
    # f = open(file_path, 'rb')
    # y = yaml.load(f)  # 采用load方法读取yaml的文件内容,以json格式展示
    # print(y['name'])

    loc1 = ('xpath', '//input[@formcontrolname="userName"]')