def curriculum_vm_script(self,i): #加载登录时的账号密码数据 user_data = self.data_value[i] # i 用户信息下标 username,password = user_data["username"],user_data["password"] #打开浏览器并访问指定url地址 driver = Select_Webdriver("Chrome").webdriver_open() driver.get(self.url) #登录操作 Login = LoginPage(driver) driver = Login.login(username,password) #学习课件打开虚机操作 Course = Currency_Script(driver,execl_name="cze_data.xls",sheet_name="cze_Learm_Curriculum") driver = Course.currency_scirpt_case(username,self.path,self.kc_jt_path)
def login(self,i): #加载登录时的账号密码数据 # self.data_value[i] = {"username":"******","password":"******"} data_value_demo = self.data_value[i] # i 账号密码获取顺序号,例:第一次取test1,第二次取test2,对应账号密码列表中下标 #打开浏览器至指定页面 driver = Select_Webdriver("Chrome").webdriver_open() driver.get(self.url) #登录操作 Login = LoginPage(driver) driver = Login.login(data_value_demo["username"],data_value_demo["password"]) #学习课件打开虚机操作 Course = Currency_Script(driver,execl_name="cze_data.xls",sheet_name="cze_Learm_Elective") driver = Course.currency_scirpt_case(data_value_demo["username"],self.path) return driver
def test_loginout(self, browser): """ 退出 :return: """ # 正式代码 page = LoginPage(browser) pages = PersonaldataPage(browser) # 测试代码 test_ALogin.Testlogin.test_login(self, "18210785192", "zl123456", browser) # 复用个人资料中定位到的“用户名”元素 pages.username_bnt.click() print("点击用户名") page.loginout_bnt.click() page.wait(2) print("点击退出登录")
def test_login(self, name, password, browser): """登录""" page = LoginPage(browser) page.get("http://test.yunmeetings.com") page.account_bnt.click() page.name_input.send_keys(name) page.password_input.send_keys(password) page.submit_bnt.click() home_page = page.one_page.text page.wait(2) assert home_page == "会议预订"
def test_Termsof(self, browser): """ 查看服务条款 :param browser: :return: """ pages = LoginPage(browser) page = Termsofservicepage(browser) page.get("http://pre.yunmeetings.com") pages.account_bnt.click() print("点击账号登录") page.register_bnt.click() print("点击注册新账号") page.register_num.click() print("手机号注册") page.terms_service.click() print("服务条款") page.wait(2) page.switch_Windows() print("跳转到服务条款页面") success = page.judge.text assert success == "企云会服务协议"
def test_login(self, name, password, browser): """ 登录-正向 :param name: 用户名 :param password: 密码 :param browser: :return: """ global page page = LoginPage(browser) page.get("http://pre.yunmeetings.com") page.account_bnt.click() print("点击账号登录") page.name_input.send_keys(name) print("输入用户名") page.password_input.send_keys(password) print("输入密码") page.submit_bnt.click() print("点击登录") home_page = page.one_page.text page.wait(2) assert home_page == "会议预订"
def to_Login(self): print("to_login1") self.find_element(self._login) return LoginPage(self.driver)
def login_page(self): return LoginPage(self.driver)