def test_Programa(self): wwwPrograma = "http://qa-test.programa.pl/users" # Using the driver instances created in EnvironmentSetup driver = self.driver self.driver.get(wwwPrograma) self.driver.set_page_load_timeout(20) # Creating object class Login # Log into email = "*****@*****.**" password = "******" login = Login(driver) login.setEmail(email) login.setPassword(password) login.click_LoginInButton() time.sleep(2) # Creating object class Users users = Users(driver) users.click_CreateButton() # Creating object class AddUser adduser = AddUser(driver) adduser.setNewUserName("User created automatically") adduser.setNewUserLastName("test") string.letters = "abcdefghijklmnopqrstuvwxyz" email = "" for x in range(15): letter = random.choice(string.letters) email = email + letter adduser.setNewUserEmail(email + "@gmail.com") adduser.clickNewUserSubmitButton() print("User was created") assert "Utworzono" in driver.page_source
def setUpClass(cls): cls.driver = webdriver.Chrome() cls.logger.info('初始化浏览器成功') cls.driver.implicitly_wait(10) cls.login = Login(cls.driver) cls.home = Home(cls.driver) cls.bid = Bid(cls.driver)
def test_Piotrklient(self): www="https://www.kurnik.pl/warcaby/" # Using the driver instances created in EnvironmentSetup driver = self.driver self.driver.get(www) self.driver.set_page_load_timeout(20) welcome=Welcome(driver) window_before = driver.window_handles[0] welcome.click_ZalogujButton() # LOG IN login=Login(driver) login.setLogin("piotrklient") login.setPassword("Politechnika") login.click_EnterButton() start=Start(driver) start.click_StartButton() window_after = driver.window_handles[1] driver.switch_to_window(window_after) #print("czeeekanie na choose900") choose900=Choose900(driver) choose900.click_ChoosekindofRoom() #tutaj wait czeka na zaproszenie #tutaj byl el= WebDriverWait(driver, 30).until( EC.visibility_of_element_located((By.XPATH, Locator.Condition))) AorDInvite=AcceptorDeclineInvite(driver) if(AorDInvite.check_Condition()==True): AorDInvite.click_AcceptInvite(driver) players=Players(driver) players.click_TakeSide2(driver) #tutaj wait czeka na accepttgame acceptgame=AcceptGame(driver) acceptgame.click_AcceptGame(driver) Coordinates=driver.find_element_by_xpath("//*[contains(@style,'top: 504') and contains(@style,'left: 84')]") while(True): print("Before click") #pierwsza dodatnia to w prawo, druga ujemna to w gore a1,a2=Movement.Get_and_Convert() action = webdriver.common.action_chains.ActionChains(driver) action.move_to_element_with_offset(Coordinates,a1, a2) action.click() action.perform() print("After click")
class LoginTest(BaseClass): def test_01login(self): self.Loogin = Login(self.driver) self.Loogin.Openloginpage() self.takescreenshot(filename="makemytrip1.png") def test_02username(self): self.Username = Login(self.driver) self.Username.enterusername() self.takescreenshot(filename="makemytrip2.png") def test_03password(self): self.Password = Login(self.driver) self.Password.enterpassword() self.takescreenshot(filename="makemytrip3.png") def test_04username(self): self.loginclick = Login(self.driver) self.loginclick.clickloginbutton()
def test_fbpage(self): driver = self.driver lg = Login(driver) lg.Login1(Username, Password)
def step_impl(context, expected_error_message): login = Login(context.driver) actual_error_message = login.Error_Message() assert actual_error_message == expected_error_message
def step_impl(context, username, password): login = Login(context.driver) login.UserName(username) login.Password(password) login.LoginButton()
def test_fblogin(self): driver = self.driver lg = Login(driver) lg.enter_un() lg.enter_pwd() lg.click_login()
def test_01login(self): self.Loogin = Login(self.driver) self.Loogin.Openloginpage() self.takescreenshot(filename="makemytrip1.png")
def test_04username(self): self.loginclick = Login(self.driver) self.loginclick.clickloginbutton()
def test_03password(self): self.Password = Login(self.driver) self.Password.enterpassword() self.takescreenshot(filename="makemytrip3.png")
def test_02username(self): self.Username = Login(self.driver) self.Username.enterusername() self.takescreenshot(filename="makemytrip2.png")
def test_login(self): driver=self.driver lp=Login(driver) lp.UserName()
def test003_Login(self): driver = self.driver login = Login(driver) login.userLogin() self.assertEqual("https://www.n11.com/", driver.current_url)
def test_FirstPlayer(self): www="https://www.kurnik.pl/warcaby/" # Using the driver instances created in EnvironmentSetup driver = self.driver self.driver.get(www) self.driver.set_page_load_timeout(20) #self.driver.implicitly_wait(10) # Creating object class Main print("1") welcome=Welcome(driver) window_before = driver.window_handles[0] welcome.click_ZalogujButton() print("2") login=Login(driver) login.setLogin("piotr1500") login.setPassword("Politechnika") login.click_EnterButton() print("3") start=Start(driver) start.click_StartButton() window_after = driver.window_handles[1] driver.switch_to_window(window_after) print("4") #print("Waiting choose900") choose900=Choose900(driver) choose900.click_ChoosekindofRoom() newgame=NewGameTable(driver) newgame.click_NewGame(driver) #tutaj wait players=Players(driver) players.click_TakeSide1() players.click_Players() #Just for show the list who want invite invite=Invite(driver) invite.click_Invite() #Invite Client (piotrklient) invitesecondplayer=InviteSecondPlayer(driver) invitesecondplayer.click_InviteSecondPlayer(driver) #tutaj wait #need to refactor time.sleep(2) p=Players(driver) ''' if p.NickPlayer.get_attribute("textContent") != "piotrklient": print("checking player") kickoff=KickOff(driver) kickoff.click_Kickoff() if p.NickPlayer.get_attribute("textContent") == "piotrklient": print("gogo") ''' WebDriverWait(driver, 20).until( EC.visibility_of_element_located((By.XPATH, "(//*[@class='butwb'])[2]"))) #need to refactor acceptgame=AcceptGame(driver) WebDriverWait(driver, 20).until( EC.element_to_be_clickable((By.XPATH, Locator.AcceptGame))) acceptgame.click_AcceptGame(driver) #print("1") #driver.execute_script("document.body.style_zoom='130%'") #driver.execute_script("document.body.style.zoom='90%'") #time.sleep(1) #driver.execute_script("document.body.style.zoom='100%'") #print("2") Coordinates=driver.find_element_by_xpath("//*[contains(@style,'top: 504') and contains(@style,'left: 84')]") while(True): print("Before click") #pierwsza dodatnia to w prawo, druga ujemna to w gore a1,a2=Movement.Get_and_Convert() action = webdriver.common.action_chains.ActionChains(driver) action.move_to_element_with_offset(Coordinates,a1, a2) action.click() action.perform() print("After click")
def test_login(self): login_page = Login(self.driver) login_page.get_forget_password().click() login_page.select_cancel_password().click() login_page.get_user_email() login_page.get_user_password() # login_page.get_login_button() fb_home_page = login_page.get_login_button() fb_home_page.get_home_link().click() # self.driver.implicitly_wait(10) time.sleep(10) fb_user_profile_page = fb_home_page.get_profile_link() # self.driver.implicitly_wait(10) # time.sleep(10) WebDriverWait(self.driver, 20).until( EC.presence_of_element_located(fb_user_profile_page.photos)) fb_user_profile_page.get_photos().click() time.sleep(5) fb_user_profile_page.get_photos_of_you().click() account_logout = fb_user_profile_page.get_all_photos() account_logout.get_account_link().click() account_logout.get_logout_link().click() time.sleep(10)