コード例 #1
0
 def getTopSiteText(self, siteElem):
     try:
         elem = self.getElement("topSites", "text", siteElem, timeout=1)
         return elem.text
     except Exception as e:
         self.log(e)
         FreshTabFailure("Error getting Text of the TopSite Element.")
コード例 #2
0
 def quickClearHistory(self):
     try:
         self.get3DotButton().click()
         self.getClearHistoryButton().click()
         self.getClearHistoryAcceptButton().click()
     except Exception as e:
         self.log(e)
         raise FreshTabFailure(
             "Error Clearing History from Fresh Tab :: History Panel")
コード例 #3
0
 def expandCollapseNews(self):
     try:
         self.clickElemCenter(self.getElement('moreNews', timeout=2))
     except:
         try:
             self.clickElemCenter(self.getElement('lessNews', timeout=2))
         except:
             raise FreshTabFailure(
                 "News Section cannot be Expanded or Collapsed.")
     self.sleep(1)
コード例 #4
0
 def getAllTopSites(self, topSitesSection=None):
     if topSitesSection == None:
         topSitesSection = self.getTopSitesSection()
     try:
         assert topSitesSection != None
         return self.getElements("topSites",
                                 "site",
                                 topSitesSection,
                                 timeout=3)
     except Exception as e:
         self.log(e)
         FreshTabFailure("Error in getting Top Sites.")
コード例 #5
0
 def getTopSiteDeleteElem(self, topSiteElem):
     try:
         if self.isPlatform("ios"):
             return self.getElement("topSites",
                                    "delete",
                                    topSiteElem,
                                    timeout=1)
         else:
             return self.getButtonInMenu("delete", isPopup=True)
     except Exception as e:
         self.log(e)
         raise FreshTabFailure("Top Site Delete button cannot be found.")
コード例 #6
0
 def getContinueToWebsiteButton(self):
     try:
         return self.getElement("homeScreenOnboarding")
     except:
         try:
             self.getStopLoadingButton().click()
             return self.getElement("homeScreenOnboarding", timeout=3)
         except Exception as e:
             self.log(e)
             try:
                 self.get3DotButton().click()
                 self.getStopLoadingButton().click()
                 return self.getElement("homeScreenOnboarding", timeout=3)
             except Exception as e:
                 self.log(e)
                 raise FreshTabFailure(
                     "Home Screen Onboarding Popup did not Load within 10 seconds."
                 )
コード例 #7
0
 def isNewsExpandedOrCollapsed(self, newsCount=None):
     if newsCount == None:
         if self.isPlatform("android"):
             newsCount = self.getNewsCount()
             return "expanded" if newsCount > self.getDefaultNewsCount(
             ) else "collapsed"
         elif self.isPlatform("ios"):
             try:
                 self.getElement('moreNews', timeout=2)
                 return "collapsed"
             except:
                 try:
                     self.getElement('lessNews', timeout=3)
                     return "expanded"
                 except:
                     raise FreshTabFailure(
                         "News Section either cannot be found or cannot be Expanded or Collapsed."
                     )
     else:
         return "expanded" if newsCount > self.getDefaultNewsCount(
         ) else "collapsed"
コード例 #8
0
 def getNewsSection(self):
     try:
         return self.getElement("newsSection")
     except:
         raise FreshTabFailure(
             "News Section did not Load within 10 seconds.")