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 __init__(self): Page.__init__(self) try: th1 = th(target=self.inotify_th, name='inotify_th') th1.daemon = True th1.start() except Exception, e: print >> sys.stderr, e
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_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_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 __init__(self): Page.__init__(self) try: for t in threading.enumerate(): print >> sys.stderr, t.name #print >> sys.stderr, dir(t) print >> sys.stderr, threading.currentThread().name th1 = th(target=self.inotify_th, name='inotify_th') th1.daemon = True th1.start() print >> sys.stderr, threading.enumerate() except Exception, e: print >> sys.stderr, e
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 api_blogs(*, page='1', tag='%'): # 注意 一般传输过程中 需要将str 的字符串改为int page_index = get_page_index(page) if tag != '%': blogs = yield from Blogs.find_all('tag like ?', [tag], OrderBy='created_time desc') if blogs: article_nums = len(blogs) else: article_nums = 0 else: article_nums = yield from Blogs.findNumber('count(id)') p = Page(article_count=article_nums, index=page_index) blogs = yield from Blogs.find_all(OrderBy='created_time desc', limit=(p.offset, p.limit)) p = Page(article_count=article_nums, index=page_index) if article_nums == 0: return dict(page=p, blogs=()) return dict(page=p, blogs=blogs)
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
def __init__(self, driver): Page.__init__(self, driver)
def get_page(self, name): REQUEST = """SELECT rowid, name, title, content, updated, published, user FROM pages WHERE (name=?)""" result = self.cursor.execute(REQUEST, (name,)).fetchone() if result: return Page.from_result(self, result)
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 __init__(self, context): Page.__init__(self, context)
def __init__(self, context): Page.__init__( self, context.browser, base_url='https://platform.operr.com/admin/index.php')