示例#1
0
 def selectDropdownListItemXpath(self, xpath, xpathItem):
     if AbstractPage.flag:
         try:
             self.getSettingPage.getElementByXPath(xpath).click()
             self.getSettingPage.getElementByXPath(xpathItem).click()
         except Exception, e:
             Log.logError(str(e))
示例#2
0
 def clickElementById(self, id):
     if AbstractPage.flag:
         try:
             element = self.getElementByID(id)
             element.click()
         except Exception, e:
             Log.logError(str(e))
示例#3
0
 def selectDropdownListItem(self, id, value):        
     if AbstractPage.flag:
         try:                
             select = Select(self.getElementByID(id))               
             select.select_by_visible_text(value)                           
         except Exception, e:
             Log.logError(str(e))
示例#4
0
 def clickElementByXPath(self, xpath):
     if AbstractPage.flag:
         try:
             element = self.getElementByXPath(xpath)
             element.click()
         except Exception, e:
             Log.logError(str(e))
示例#5
0
 def getLocationForElementById(self, id):
     if AbstractPage.flag:
         try:
             element = self.getElementByID(id)
             return element.location['x'], element.location['y']
         except Exception, e:
             Log.logError(str(e))
示例#6
0
 def getLocationForElementXpath(self, xPath):
     if AbstractPage.flag:
         try:
             element = self.getElementByXPath(xPath)
             return element.location['x'], element.location['y']
         except Exception, e:
             Log.logError(str(e))
示例#7
0
 def getNameOfPicture(self):
     if AbstractPage.flag:
         try:                                                                                
             return self.getAttributeByXPath(self.img_myProfile_xpath, "title")
             
         except Exception, e:
             Log.logError(str(e))
示例#8
0
 def isScoreExisted_profilePage(self):   
     if AbstractPage.flag:                                                          
         if self.checkControlExistedByXpath(self.img_score_xpath):
             Log.logInfo("Control Score is existed!")
             return True
         else:
             Log.logInfo("Control Score is not existed!")
             return False
示例#9
0
 def mouseMoveToElementById(self, elementID):
     if AbstractPage.flag:
         try:
             element = self.getElementByID(elementID)
             hov = ActionChains(AbstractPage.Browser()).move_to_element(element)
             hov.perform()
         except Exception, e:
             Log.logError(str(e))
示例#10
0
 def checkControlExistedByXpath(self,element_xpath, timeout = 60):
     if AbstractPage.flag:
         try:
             WebDriverWait(AbstractPage.Browser, timeout).until(lambda driver: AbstractPage.Browser().find_element_by_xpath(element_xpath))
             return True
         except Exception, e:
             Log.logError(str(e))
             return False
示例#11
0
 def isPopupAddFriendTwitterDisplay(self):
     if AbstractPage.flag:
         if self.checkControlExistedById(self.btn_tweet_xpath):
             Log.logInfo("Popup Add Friend Twitter displays!")
             return True
         else:
             Log.logInfo("Popup Add Friend Twitter is not displayed!")
             return False
示例#12
0
 def isPopupDisplayed(self):
     if AbstractPage.flag:
         if self.checkControlExistedByXpath(self.img_closePopup_xpath):
             Log.logInfo("Popup displayed!")
             return True
         else:
             Log.logInfo("Popup is not displayed!")
             return False
示例#13
0
 def isProfilePageExisted(self):
     if AbstractPage.flag:
         if self.isScoreExisted()and self.isProfilePictureExisted():
             Log.logInfo("Profile Page is existed!")
             return True
         else:
             Log.logInfo("Profile Page is not existed!")
             return False
示例#14
0
 def isScoreExisted(self):   
     if AbstractPage.flag:                                                                              
         if self.checkControlExistedByXpath(self.img_score_xpath):
             Log.logInfo("Score picture is existed")
             return True
         else:
             Log.logInfo("Score picture is not existed")
             return False
示例#15
0
 def isPopupDisplayed(self):
     if AbstractPage.flag:
         if self.checkControlExistedByXpath(self.img_closePopup_xpath):
             Log.logInfo("Popup displayed!")
             return True
         else:
             Log.logInfo("Popup is not displayed!")
             return False
示例#16
0
 def getTextById(self, id):
     if AbstractPage.flag:
         try:
             element = self.getElementByID(id)
             return element.text      
         except Exception, e:
             Log.logError(str(e))
             AbstractPage.flag = False
示例#17
0
 def getTextByXPath(self, xpath):
     if AbstractPage.flag:
         try:
             element = self.getElementByXPath(xpath)
             return element.text      
         except Exception, e:
             Log.logError(str(e))
             AbstractPage.flag = False
示例#18
0
 def getAttributeById(self, id, attributeName):
     if AbstractPage.flag:
         try:
             element = self.getElementByID(id)
             return element.get_attribute(attributeName)
         except Exception, e:
             Log.logError(str(e))
             AbstractPage.flag = False
示例#19
0
 def isSeemoreLinkExist(self):
     if AbstractPage.flag:
         if self.checkControlExistedByXpath(self.link_seeMoreTopic_xpath):
             Log.logInfo("See more link is existed!")
             return True
         else:
             Log.logInfo("See more link is not existed!")
             return False
示例#20
0
 def sendKeyById(self, id, value):
     if AbstractPage.flag:
         try:
             element = self.getElementByID(id)
             element.clear()
             element.send_keys(value)
         except Exception, e:
             Log.logError(str(e))
示例#21
0
 def isProfilePictureExisted(self):   
     if AbstractPage.flag:                                                                              
         if self.checkControlExistedByXpath(self.img_myProfile_xpath):
             Log.logInfo("Profile's picture is existed!")
             return True
         else:
             Log.logInfo("Profile's picture is not existed!")
             return False
示例#22
0
 def sendKeyByxPath(self, xPath, value):
     if AbstractPage.flag:
         try:
             element = self.getElementByXPath(xPath)
             element.clear()
             element.send_keys(value)
         except Exception, e:
             Log.logError(str(e))
示例#23
0
 def isLogoutPageSuccessfully(self):
     if AbstractPage.flag:
         if self.checkControlExistedByXpath(self.btn_twitter_xpath):
             Log.logInfo("Logout facebook completely")
             return True
         else:
             Log.logInfo("Logout facebook imcompletely")
             return False
示例#24
0
 def closeBrowser():
     try:
         AbstractPage.Browser().quit()
         AbstractPage.browser = None
         AbstractPage.flag = True
         Log.logInfo("Close browser")
     except Exception, e:
         Log.logError(str(e))
示例#25
0
 def isScoreExisted_profilePage(self):
     if AbstractPage.flag:
         if self.checkControlExistedByXpath(self.img_score_xpath):
             Log.logInfo("Control Score is existed!")
             return True
         else:
             Log.logInfo("Control Score is not existed!")
             return False
示例#26
0
 def getElementByXPath(self, xPath, timeout = 30):
     if AbstractPage.flag:
         try:
             WebDriverWait(AbstractPage.Browser, timeout).until(lambda driver: AbstractPage.Browser().find_element_by_xpath(xPath))
             return AbstractPage.Browser().find_element_by_xpath(xPath)
         except Exception, e:
             Log.logError(str(e))
             AbstractPage.flag = False
示例#27
0
 def isSeemoreLinkExist(self):
     if AbstractPage.flag:
         if self.checkControlExistedByXpath(self.link_seeMoreTopic_xpath):
             Log.logInfo("See more link is existed!")
             return True
         else:
             Log.logInfo("See more link is not existed!")
             return False
示例#28
0
 def isHomePageKloutExist(self):   
     if AbstractPage.flag:                                                                                              
         if self.checkControlExistedByXpath(self.frm_score_network_pic_xpath):
             Log.logInfo("Klout Home Page is existed!")
             return True
         else:
             Log.logInfo("Klout Home Page is not existed!")
             return False
示例#29
0
 def isNetworkStatsFacebookExist(self):   
     if AbstractPage.flag:                                                                              
         if self.checkControlExistedByXpath(self.lbl_networkStatsFacebook_xpath):
             Log.logInfo("Network stats Facebook is existed!")
             return True
         else:
             Log.logInfo("Network stats Facebook is not existed!")
             return False
示例#30
0
 def is90DayScoreHistoryExist(self):   
     if AbstractPage.flag:                                                                                            
         if self.checkControlExistedById(self.chart_90DayScoreHistory_ID):
             Log.logInfo("90 day score history is existed!")
             return True
         else:
             Log.logInfo("90 day score history is not existed!")
             return False
示例#31
0
 def isDeltaQuarterExist(self):   
     if AbstractPage.flag:                                                                               
         if self.checkControlExistedByXpath(self.lb_deltaQuarterValue_xpath) and self.checkControlExistedByXpath(self.lb_deltaQuarterTitle_xpath):
             Log.logInfo("Delta Quarter is existed!")
             return True
         else:
             Log.logInfo("Delta Quarter is not existed!")
             return False
示例#32
0
 def isPopupDisplayed(self):
     if AbstractPage.flag:
         if self.checkControlExistedById(self.pw_confirm_dialog_id):
             Log.logInfo("Popup displayed!")
             return True
         else:
             Log.logInfo("Popup is not displayed!")
             return False
示例#33
0
 def isNetworkStatsGooglePlusExist(self):   
     if AbstractPage.flag:                                                                           
         if self.checkControlExistedByXpath(self.lbl_networkStatsGoogleplus_xpath):
             Log.logInfo("Network stats google plus is existed!")
             return True
         else:
             Log.logInfo("Network stats google plus is not existed!")
             return False       
示例#34
0
 def isPopupAddFacebookFriendDisplay(self):
     if AbstractPage.flag:
         if self.checkControlExistedById(self.pw_inviteFacebookFriend_id):
             Log.logInfo("Popup Add Facebook Friend displays!")
             return True
         else:
             Log.logInfo("Popup Add Facebook Friend is not displays!")
             return False
示例#35
0
 def isTwitterListExisted(self):
     if AbstractPage.flag:
         if self.checkControlExistedByXpath(self.pl_TWFriend_xpath):
             Log.logInfo("Twitter list element existed!")
             return True
         else:
             Log.logInfo("Twitter list element is not existed!")
             return False
示例#36
0
    def getNameOfPicture(self):
        if AbstractPage.flag:
            try:
                return self.getAttributeByXPath(self.img_myProfile_xpath,
                                                "title")

            except Exception, e:
                Log.logError(str(e))
示例#37
0
 def isPopupAddFacebookFriendDisplay(self):
     if AbstractPage.flag:
         if self.checkControlExistedById(self.pw_inviteFacebookFriend_id): 
             Log.logInfo("Popup Add Facebook Friend displays!")
             return True
         else:
             Log.logInfo("Popup Add Facebook Friend is not displays!")
             return False
示例#38
0
 def isProfilePictureExisted(self):
     if AbstractPage.flag:
         if self.checkControlExistedByXpath(self.img_myProfile_xpath):
             Log.logInfo("Profile's picture is existed!")
             return True
         else:
             Log.logInfo("Profile's picture is not existed!")
             return False
示例#39
0
 def isProfilePageExisted(self):
     if AbstractPage.flag:
         if self.isScoreExisted() and self.isProfilePictureExisted():
             Log.logInfo("Profile Page is existed!")
             return True
         else:
             Log.logInfo("Profile Page is not existed!")
             return False
示例#40
0
 def isScoreExisted(self):
     if AbstractPage.flag:
         if self.checkControlExistedByXpath(self.img_score_xpath):
             Log.logInfo("Score picture is existed")
             return True
         else:
             Log.logInfo("Score picture is not existed")
             return False
示例#41
0
 def isPopupDisplayed(self):
     if AbstractPage.flag:               
         if self.checkControlExistedById(self.pw_confirm_dialog_id):
             Log.logInfo("Popup displayed!")
             return True
         else:
             Log.logInfo("Popup is not displayed!")
             return False
示例#42
0
 def isTwitterListExisted(self):
     if AbstractPage.flag:                                                                                         
         if self.checkControlExistedByXpath(self.pl_TWFriend_xpath):
             Log.logInfo("Twitter list element existed!")
             return True
         else:
             Log.logInfo("Twitter list element is not existed!")
             return False              
示例#43
0
 def isNetworkUsedExist(self):   
     if AbstractPage.flag:                                                                              
         if self.checkControlExistedById(self.graph_networksUsed_ID):
             Log.logInfo("Network used graph is existed!")
             return True
         else:
             Log.logInfo("Network used graph is not existed!")
             return False
示例#44
0
 def isPopupAddFriendTwitterDisplay(self):
     if AbstractPage.flag:
         if self.checkControlExistedById(self.btn_tweet_xpath):
             Log.logInfo("Popup Add Friend Twitter displays!")
             return True
         else:
             Log.logInfo("Popup Add Friend Twitter is not displayed!")
             return False
示例#45
0
 def isLoginPageKloutExist(self):   
     if AbstractPage.flag:                                                                               
         if self.checkControlExistedByXpath(self.btn_facebook_xpath):
             Log.logInfo("Login Page Klout Existed")
             return True
         else:
             Log.logInfo("Login Page Klout is not existed")
             return False
示例#46
0
 def isAllFriendCheckboxChecked(self):
     if AbstractPage.flag:
         ischecked = self.getAttributeByXPath(self.chb_selectAllFriend_xpath, "checked")
         if(ischecked == "true"):
             Log.logInfo("All Friend Checkbox is checked")
             return True
         else:
             Log.logInfo("All Friend Checkbox is not checked")
             return False