def test_register(self, danweiname, province, city, area, email, username, phonenum, password1, password2): # 声明LoginPage类对象 register_page = RegisterPage(self.driver, self.url) # 调用打开页面组件 register_page.open() register_page.input_danweiname(danweiname)
def test_Register(self, testFixtures): homePage = HomePage(self.driver) homePage.navigate_to_login_page() userInfo = UserDataBean().get_random_user_data() registerPage = RegisterPage(self.driver) registerPage.navigate_to_registration_page(userInfo) registerPage.fill_registration_details(userInfo)
from GeneralUtilities import BrowserFunctions import Pages from Pages.RegisterPage import RegisterPage from Pages.MainPage import MainPage from Pages.SettingsPage import UserSettingsPage from Pages.AccountSettingsPage import AccountSettingsPage from Pages.ProfileSettingsPage import ProfileSettingsPage from selenium.webdriver import ActionChains import time from selenium.webdriver.common.keys import Keys driver=BrowserFunctions.BrowserLoad() rp=RegisterPage(driver) rp.emailfield.send_keys('is it working ??') rp.emailfield.clear() rp.usernamefield.send_keys('goodddaaaamnnn') rp.passwordfield.send_keys('assdfgfbdfgsd') rp.registerbutton.click() print(driver.current_url)
def register(name, email, phone): register_page = RegisterPage(get_driver()) register_page.open_page() register_page.register(name, email, phone)
def test_Register(self): # se face o metoda de test # declaram un obiect de tipul elementmethod pentru a folosi metodele generale self.elementmethods = ElementMethods(self.driver) self.pagemethods = PageMethods(self.driver) #declaram un obiect de tipul excel de la o anumita locatie si cu un sheet specific self.excelUtility = ExcelUtility("../Libre/DataDrivenTesting.xlsx", "ForRegister") # validam pagina pe care ne aflam # completam fieldul de first name si last name (radiobox) self.registerPage = RegisterPage(self.driver) self.registerPage.registerProcess( self.excelUtility.readDataByIndex(2, 2), "Buna") #dupa ce am terminat de declarat elementele+elementul submit #self.registerPage.clickSubmit() self.addressweb = self.driver.find_element_by_xpath("//textarea") self.elementmethods.WriteElement(self.addressweb, "sjhasgd") self.emailaddressweb = self.driver.find_element_by_xpath( "//input[@ng-model='EmailAdress']") self.elementmethods.WriteElement( self.emailaddressweb, self.excelUtility.readDataByIndex(4, 2)) self.phonenumberweb = self.driver.find_element_by_xpath( "//input[@type='tel']") self.elementmethods.WriteElement(self.phonenumberweb, "3475322958") # selectam un gen (checkbox) # selectam un hobby self.cricket = self.driver.find_element_by_xpath( "//input[@value='Cricket']") self.elementmethods.ClickElement(self.cricket) # alegem valoarea dintr-un dropdown self.countryweb = self.driver.find_element_by_id("countries") self.elementmethods.SelectElementByText(self.countryweb, "Romania") self.yearweb = self.driver.find_element_by_id("yearbox") self.elementmethods.SelectElementByValue(self.yearweb, "1994") self.monthweb = self.driver.find_element_by_xpath( "//select[@placeholder='Month']") self.elementmethods.SelectElementByText(self.monthweb, "August") self.dayweb = self.driver.find_element_by_xpath( "//select[@placeholder='Day']") self.elementmethods.SelectElementByValue(self.dayweb, "2") self.passwordweb = self.driver.find_element_by_id("firstpassword") self.elementmethods.WriteElement(self.passwordweb, "Qwerty1") self.confirmpasswordweb = self.driver.find_element_by_id( "secondpassword") self.elementmethods.WriteElement(self.confirmpasswordweb, "Qwerty1") self.submitweb = self.driver.find_element_by_id("submitbtn") self.elementmethods.ClickElement(self.submitweb) self.driver.find_element_by_xpath("//body[@ng-controller='gridctrl']") self.expectednextpage = "Web Table" self.pagemethods.ValidateTitlePage(self.expectednextpage) time.sleep(5)