def login(self): self.enter_username(username) print 'username ', G , username , W sleep(2) self.enter_password(password) print 'password ', G , password , W sleep(2) self.click_login() print "Funcion clik Login", O, "....",W sleep(2) #ttcode add df memeber info button self.click_members_info_button() print "Funcion clik member info button", O, "....",W sleep(2) # df member link Page.wait_for_element(self, *MainPageLocators.MEMBERS_LINK) self.click_members_link() #print MEMBERS_LINK print "Funcion clik Member Link" , G, "OK",W # self.click_members_link_historial() print 'click historial function'
def enter_username(self, name): Page.wait_for_element(self, *MainPageLocators.USERNAME_INPUT) self.clear_username() self.driver.find_element( *MainPageLocators.USERNAME_INPUT).send_keys(name) print "username input" ,G , username, W
def login(self): self.enter_username("dhiggs45") self.enter_password("") sleep(1) self.click_login() Page.wait_for_element(self, *MainPageLocators.MEMBERS_LINK) self.click_members_link()
def click_show_more_until_no_more(self): while (self.is_show_more_present()): try: Page.wait_for_element(self, *PopUpWindowLocators.SHOW_MORE_BTN) self.show_more() except Exception as e: print(e) break finally: pass
def get_bet_history(self): Page.wait_for_element(self, *PopUpWindowLocators.SHOW_MORE_BTN) self.click_show_more_until_no_more() sleep(2) Page.wait_for_element(self, *PopUpWindowLocators.BET_CONFIRMATION) bets = self.driver.find_elements( *PopUpWindowLocators.BET_CONFIRMATION_LINK) return self.get_bet_details(bets)
def get_list_of_bets(self): self.switch_to_bet_history_iframe() bets = self.driver.find_elements(*PopUpWindowLocators.BET_ITEMS) for bet in bets: self.driver.switch_to_window() bet.send_keys(Keys.ENTER) if (bet.is_displayed and bet.is_enabled): bet.click() Page.wait_for_element(self, *PopUpWindowLocators.BET_CONFIRMATION)
def get_bet_details(self, bets): self.bets = [] Page.wait_for_element(self, *PopUpWindowLocators.BET_CONFIRMATION) bet_confirmation = self.driver.find_elements( *PopUpWindowLocators.BET_CONFIRMATION) Page.wait_for_element(self, *PopUpWindowLocators.BET_RETURN) stakes = self.driver.find_elements(*PopUpWindowLocators.BET_STAKE) returns = self.driver.find_elements( *PopUpWindowLocators.BET_RETURN) for index, bet in enumerate(bets): try: self.bet_obj = {} self.bet_obj['bet_stake'] = stakes[index].text self.bet_obj['bet_return'] = returns[index].text bet.click() Page.wait_for_element( self, *PopUpWindowLocators.BET_CONFIRMATION) Page.wait_for_element(self, *PopUpWindowLocators.BET_TYPE) sleep(1) self.bet_obj['bet_type'] = bet_confirmation[index].find_element( *PopUpWindowLocators.BET_TYPE).text self.bet_obj['bet_event'] = bet_confirmation[index].find_element( *PopUpWindowLocators.BET_EVENT).text self.bet_obj['bet_date'] = bet_confirmation[index].find_element( *PopUpWindowLocators.BET_DATE).text self.bet_obj['bet_odds'] = bet_confirmation[index].find_element( *PopUpWindowLocators.BET_ODDS).text self.bet_obj['bet_result'] = bet_confirmation[index].find_element( *PopUpWindowLocators.BET_RESULT).text self.bet_obj['bet_id'] = bet_confirmation[index].find_element( *PopUpWindowLocators.BET_ID).text except Exception as e: pass finally: pass self.bets.append(self.bet_obj) bet.click() return self.bets
def click_members_link(self): Page.wait_for_element(self, *MainPageLocators.MEMBERS_LINK) self.driver.find_element(*MainPageLocators.MEMBERS_LINK).click()
def enter_password(self, name): Page.wait_for_element(self, *MainPageLocators.PASSWORD_INPUT) self.driver.execute_script(MainPageLocators.PASSWORD_INPUT_REVEAL) self.driver.find_element(*MainPageLocators.PASSWORD_INPUT).click()
def click_members_link(self): Page.wait_for_element(self, *MainPageLocators.MEMBERS_LINK) self.driver.find_element(*MainPageLocators.MEMBERS_LINK).click() print 'Link Member Click', G, 'OK!',W print P, (self.driver.current_url) , W