def setUpClass(cls): cls.driver = webdriver.Firefox() cls.driver.get(login_url) #先登录 a = Login(cls.driver) #起始位置 a.login() cls.student = AddStudentInfo(cls.driver) cls.student.gengduo()
def setUp(self): global driver, check, user browser = Browsers(browserType) driver = webdriver.Chrome(browser.select_browser()) #登录 user = Login(driver) user.login(address, account, password) check = AssertFunction() self.assertTrue(check.isElementExist(driver, e_personalDetails)) self.assertIn('homepage', driver.current_url)
def app_setup(self): self.webdriver = webdriver.Chrome() self.home_page = HomePage(self.webdriver) self.login_page = Login(self.webdriver) self.landing_page_hotel = LandingPageHotel(self.webdriver) self.valid_credentials = conf_reader.get_user_credentials() self.search_result_page = SearchResultPage(self.webdriver) yield self.webdriver.quit()
def setup(self): """ This fixture holds the common setup steps required to Login to the application returns: Home page of the application for authenticated users """ self.webdriver = webdriver.Chrome() self.base_page = BasePage(self.webdriver) self.home_page = HomePage(self.webdriver) self.login_page = Login(self.webdriver) self.search_result_page = SearchResultPage(self.webdriver) self.valid_credentials = conf_reader.get_user_credentials() self.landing_page_hotel = LandingPageHotel(self.webdriver) self.home_page.open_login_page() yield self.webdriver.quit()
def setup(self): """Tours This fixture holds the common setup steps required to Login to the application returns: Home page of the application for authenticated users """ self.webdriver = webdriver.Chrome() self.home_page = HomePage(self.webdriver) self.login_page = Login(self.webdriver) self.search_result_page = SearchResultPage(self.webdriver) self.valid_credentials = conf_reader.get_user_credentials() self.landing_page_tours = LandingPageTour(self.webdriver) self.home_page.open_login_page() self.login_page.user_login(self.valid_credentials.email, self.valid_credentials.password) self.landing_page_tours.click_tour_button() yield self.webdriver.quit()
def setUp(self): global driver, check, sip, group, user browser = Browsers(browserType) driver = webdriver.Chrome(browser.select_browser()) #登录 user = Login(driver) user.login(address, account, password) check = AssertFunction() self.assertTrue(check.isElementExist(driver, e_personalDetails)) self.assertIn('homepage', driver.current_url) #添加线路 sip = SipPage(driver) sip.into_sip() #添加线路 sip.add_sip(sipAccount, sipPassword, sipIp, sipPort, city) #断言 self.assertTrue(check.isElementExist(driver, e_assertSip, sipAccount)) #添加客户组导入号码 group = cusManage(driver) group.cus_manage() group.add_group(groupName, number) self.assertTrue(check.isElementExist(driver, e_deleteGroup, groupName))
def setUpClass(cls): cls.driver = webdriver.Firefox() cls.bug = ZenTaoBug(cls.driver) cls.a = Login(cls.driver) cls.a.login()
def startLogin(self): driver = ChromeDriver.getFromChrome(ChromeDriver) login = Login(driver) login.sendUsername() login.sendPassword() login.clicklogIn()
def objectSetup(self, getDriver): log = cl.customLogger(logging.DEBUG) log.info("=" * 50) log.info("Login Operation") self.lp = Login(getDriver)
def setUpClass(cls): cls.driver = webdriver.Chrome() cls.add_free = FreeBuy(cls.driver) a = Login(cls.driver) a.login()
from behave import * from selene.browser import * from pages.login_page import Login login_page = Login() @given('I have opened login page') def step_impl(context): open_url("/login") @when('I login with "{username}" name and "{password}" password') def step_impl(context, username, password): login_page.login(username, password) @then('I see "{text}" text') def step_impl(context, text): message = login_page.get_Message() assert message == text @when('I refresh cookie') def step_impl(context): driver().delete_all_cookies() driver().refresh() @when( 'I login through the http with "{username}" name and "{password}" password'
def test_login_jenkins(self): driver = self.driver lp = Login(driver) lp.enter_user_name() lp.enter_password() lp.click_signin_button()
def setUpClass(cls): cls.driver = webdriver.Firefox() cls.addbug = Addbug(cls.driver) cls.login = Login(cls.driver)
def test_login(self): obj_login = Login() obj_login.allow_access()
def setUpClass(cls): cls.driver = webdriver.Chrome() cls.login_page = Login(cls.driver) cls.driver.maximize_window()
def setUp(self): self.driver = webdriver.Firefox() self.driver.get(login_url) self.a = Login(self.driver)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.base_selenium = BaseSelenium() self.login_page = Login() self.home_page = HomePage()
def setUpClass(cls): cls.driver = webdriver.Firefox() cls.zentaologin = Login(cls.driver)
def is_add_student_success(self, text): #判断text“学生名称”在列表里 包含 00:43 #“学生名称”在当前页 #t = self.driver.page_source #获取当前页整个html源码, 方法1 body = ("tag name", "body") #获取当前页所有tag的名字 t2 = self.find(body).text #print(t2) return text in t2 def is_add_success(self,s_id): #第二种判断 学号,判断方法是多种多样的 t = self.get_text(self.loc_r) print("获取的学号:%s" %t) return s_id == t #此时可以看下网页代码,如果不是纯文本,包含空格和其他时,可以用包含 if __name__ == '__main__': from selenium import webdriver driver = webdriver.Firefox() driver.get("http://47.104.190.48:8000/login") a = Login(driver) a.login() #先登录 b = AddStudentInfo(driver) #到添加学生页面 b.gengduo() b.add_student("20000008", "zzzsss") result = b.is_add_student_success("zzzsss") print("结果: %s"%result) t3 = b.is_add_success("20000008") print(t3)
def setUpClass(cls): cls.driver = webdriver.Firefox() #打开浏览器 cls.zentao = ZenTaoBug(cls.driver) cls.l = Login(cls.driver) cls.l.login() #登录