Exemplo n.º 1
0
 def moveMouseToMenu(self):
     logger.info("Trying to move mouse to menu")
     try:
         Wait.WaitXpath(self.menuXpath, self.WaitTime)
     except TimeoutException:
         logger.error("Cannot find element! " + self.menuXpath)
     MouseOperations.MoveMouseXpath(self.menuXpath)
 def findHighestDiscount(self):
     logger.info("Waiting for the DOM to load the class")
     Wait.WaitXpath(self.topSellRowXpath, self.WaitTime)
     #topSellRow = RunBrowser().driver.find_element_by_xpath(self.topSellRowXpath)
     topSellRow = ElementOperations.findOneElement().byXpath(
         self.topSellRowXpath,
         RunBrowser().driver)
     discountElems = ElementOperations.findManyElements.byXpath(
         self, self.discountXpath, topSellRow)
     logger.info("Trying to sort elements from low to hight")
     sortedDisc = ActionPageLogic.SortDiscountElems().get(discountElems)
     try:
         gamesPageDiscount = sortedDisc[-1][1]  # %
     except:
         logger.error("No games with any discount")
     gamesPagePrice = ElementOperations.findOneElement.byXpath(
         self, self.originalPriceXpath,
         sortedDisc[-1][0]).text  # WithoutDiscount
     gamesPageDiscountPrice = ElementOperations.findOneElement.byXpath(
         self, self.discountPriceXpath,
         sortedDisc[-1][0]).text  # WithDiscount
     gameName = ElementOperations.findOneElement.byXpath(
         self, self.GameName, sortedDisc[-1][0]).text
     data = [
         gamesPageDiscount, gamesPagePrice, gamesPageDiscountPrice, gameName
     ]
     logger.info("Getting data: " + ", ".join(data))
     logger.info("Trying to click game button with highest discount")
     sortedDisc[-1][0].click()
     return (data)
Exemplo n.º 3
0
 def getPrices(self):
     logger.info("Waiting for the DOM to load the class")
     try:
         Wait.WaitXpath(self.DiscountXpath, self.WaitTime)
     except TimeoutException:
         logger.error("Cannot find element! " + self.DiscountXpath)
     try:
         gamePageDiscount = ElementOperations.findOneElement.byXpath(
             self, self.DiscountXpath,
             RunBrowser().driver).text
         gamePagePrice = ElementOperations.findOneElement.byXpath(
             self, self.PriceOnPageXpath,
             RunBrowser().driver).text
         gamePageDiscountPrice = ElementOperations.findOneElement.byXpath(
             self, self.discountPriceOnPageXpath,
             RunBrowser().driver).text
         gamePageName = ElementOperations.findOneElement.byXpath(
             self, self.GameName,
             RunBrowser().driver).text
     except NoSuchElementException:
         logger.error("Cannot find one of elements!")
     gameData = [
         gamePageDiscount, gamePagePrice, gamePageDiscountPrice,
         gamePageName
     ]
     logger.info("Getting element data from the page: " +
                 ", ".join(gameData))
     return (gameData)
 def navigateToTopSelling(self):
     logger.info("Waiting for the DOM to load the class")
     try:
         Wait.WaitXpath(self.actionTitleXpath, self.WaitTime)
     except TimeoutException:
         logger.error("Cannot find element! " + self.actionTitleXpath)
     logger.info("Trying to click element: " + self.topSellXpath)
     ButtonOperations.ClickButtonXpath(self.topSellXpath)
Exemplo n.º 5
0
 def clickButtonToDownload(self):
     logger.info("Waiting for the DOM to load the class")
     try:
         Wait.WaitXpath(self.MainLogoXpath, self.WaitTime)
     except TimeoutException:
         logger.error("Cannot find element! " + self.MainLogoXpath)
     logger.info("Trying to click download button")
     ButtonOperations.ClickButtonClass(self.DownloadButtonClass)
Exemplo n.º 6
0
 def clickButtonToDownload(self):
     logger.info("Waiting for the DOM to load the class")
     try:
         Wait.WaitClass(self.downloadButtonClass, self.waitTime)
     except TimeoutException:
         logger.error("Cannot find element! " + self.downloadButtonClass)
     logger.info("Trying to click button with class: " +
                 self.downloadButtonClass)
     ButtonOperations.ClickButtonClass(self.downloadButtonClass)
Exemplo n.º 7
0
 def clickIndie(self):
     logger.info("Waiting for the DOM to load the class")
     Wait.WaitXpath(self.indieXpath, self.WaitTime)
     logger.info("Trying to click Indie button")
     ButtonOperations.ClickButtonXpath(self.indieXpath)