def findTickets(self, fromC, toC):
        logger.info("Trying to remvoe booking checkbox")
        ElementOperations.Input(
            locatorType="Xpath",
            locator=self.openBookingXpath).click()  # Remove checkbox
        logger.info("Trying to click THERE button")
        ElementOperations.Button(locatorType="Xpath",
                                 locator=self.ThereXpath).click()  #There .Куда
        logger.info("Trying to choose a random day")
        day = MainPageLogic.logic().chooseRandomDate()
        dayText = ElementOperations.Element(element=day).getText()
        logger.info("Trying to click on a random day " + dayText)
        ElementOperations.Element(element=day).click()  #click on random day
        logger.info("Trying to click back button")
        ElementOperations.Button(
            locatorType="Xpath",
            locator=self.FromThereXpath).click()  #Back  .Обратно
        logger.info("Trying to click 'Обратный билет не нужен' button")
        ElementOperations.Button(
            locatorType="Xpath",
            locator=self.BackTicketXpath).click()  #dont need backtitle

        logger.info("Trying to click FROM button")
        ElementOperations.Input(locatorType="Xpath",
                                locator=self.FromXpath).click()  # click [FROM]
        logger.info("Trying to send BACKSPASE button to input")
        ElementOperations.Input(locatorType="Xpath",
                                locator=self.FromXpath).send(Keys.BACKSPACE)
        logger.info("Trying to send text " + fromC + " to FROM input")
        ElementOperations.Input(locatorType="Xpath",
                                locator=self.FromXpath).send(
                                    fromC)  #send text [FROM]

        logger.info("Trying to click TO input")
        ElementOperations.Input(locatorType="Xpath",
                                locator=self.ToXpath).click()  #click [TO]
        logger.info("Trying to send text " + toC + " to TO input")
        ElementOperations.Input(locatorType="Xpath",
                                locator=self.ToXpath).send(
                                    toC)  #send text [TO]
        logger.info("Trying to click TO input")
        ElementOperations.Input(locatorType="Xpath",
                                locator=self.ToXpath).click()
        logger.info("Trying to find dropdown")
        try:
            ElementOperations.Button(locatorType="Xpath",
                                     locator=self.DropdownXpath)._find(
                                         2)  #wait for text
        except:
            pass
        logger.info("Trying to click TO input")
        ElementOperations.Input(locatorType="Xpath",
                                locator=self.ToXpath).click()  # click [TO]
        logger.info("Trying to click confirm button")
        ElementOperations.Button(locatorType="Xpath",
                                 locator=self.ConfirmXpath).click()  # CONFIRM
        return dayText
Ejemplo n.º 2
0
 def __init__(self):
     self.loginField = ElementOperations.Input(
         By.XPATH, "//input[@id='index_email']")
     self.passwordField = ElementOperations.Input(
         By.XPATH, "//input[@id='index_pass']")
     self.confirmButton = ElementOperations.Button(
         By.XPATH, "//button[@id='index_login_button']")
Ejemplo n.º 3
0
 def checkImagePost(self, post_id):
     path = self.imagePathStart + str(post_id) + self.imagePathEnd
     elem = ElementOperations.Button(By.XPATH, path)
     elem.move()
     elem.send(Keys.DOWN)
     image = elem._find(5)
     with open(self.dwnld_path, 'wb') as file:
         file.write(image.screenshot_as_png)
     return image
    def setBagage(self):
        logger.info("Trying to open baggage dropdown in filters")
        ElementOperations.Button(locatorType="Xpath",
                                 locator=self.BagageXpath).click()
        logger.info("Trying to click ALL baggage checkbox")
        ElementOperations.Button(locatorType="Xpath",
                                 locator=self.BagageOpenedAll).click()
        logger.info("Trying to click full baggage checkbox")
        ElementOperations.Button(locatorType="Xpath",
                                 locator=self.FullBagageXpath).click()

        logger.info("Trying to find tickets")
        tickets = ElementOperations.ManyElements(
            locatorType="Xpath", locator=self.TicketTextXpath).find()
        logger.info("Trying to find tickets with baggage")
        withBagage = ElementOperations.ManyElements(
            locatorType="Xpath", locator=self.BagageTitleTextXpath).find()
        logger.info("Trying calculate tickets")
        lenTick = len(tickets)
        logger.info("Trying to calculate tickets with baggage")
        lenBagage = len(withBagage)
        return lenTick, lenBagage
Ejemplo n.º 5
0
 def __init__(self, elem = ""):
     BaseForm.__init__(self, elem)
     self.mainPageButton = ElementOperations.Button(By.XPATH, "//li[@id='l_pr']/a")
     self.firstPostText = ElementOperations.Label(By.XPATH, "//div[@class='wall_post_cont _wall_post_cont']")
     self.id = "id"
     self.idPrefix = "wpt"
     self.partContainsDivClass = '//a[contains(@onclick, "'
     self.closeAfterVar = '") and contains(@title, "Нравится")]'
     self.commentTextStart = '//div[contains(@id, "'
     self.commentTextEnd = '")]/div[@class="wall_reply_text"]'
     self.parent = '//parent::div'
     self.imagePathStart = '//div[contains(@id, "'
     self.imagePathEnd = '") and @class = "wall_post_cont _wall_post_cont"]/div[@class="page_post_sized_thumbs  clear_fix"]/a'
     self.pattern = r"\d+"
     self.back = "/.."
     self.dwnld_path = 'resources/files/filename.png'
 def findStraightPath(self):
     logger.info("Trying to click 'Прямой' button")
     ElementOperations.Button(locatorType="Xpath",
                              locator=self.StraightTextXpath).click()
 def waitLoad(self):
     logger.info("Waiting for all results load")
     ElementOperations.Button("Xpath",
                              self.loaderAnimationFinishedXpath)._find()
Ejemplo n.º 8
0
 def clickLikeButton(self, post_id):
     path = self.partContainsDivClass + str(post_id) + self.closeAfterVar
     ElementOperations.Button(By.XPATH, path).click()
Ejemplo n.º 9
0
 def findPostById(self, user_id, post_id):
     id = self.idPrefix + str(user_id) + "_" + str(post_id)
     elem = ElementOperations.Button(By.ID, id)._find()
     return elem
Ejemplo n.º 10
0
 def sendCreditalsDropDown(self):
     ElementOperations.Button(By.XPATH, self.DropDownField).click()
     ElementOperations.DropDown(By.XPATH,
                                self.DropDownelements).random().click()
     ElementOperations.CheckBox(By.XPATH, self.StartCheckBox).click()
     ElementOperations.Button(By.XPATH, self.NextXpath).click()
Ejemplo n.º 11
0
 def removeHelp(self):
     elem = ElementOperations.Button(By.XPATH, self.HideHelpXpath)._find()
     ElementOperations.Button(By.XPATH, self.HideHelpXpath).click()
     return elem
Ejemplo n.º 12
0
    def removeCookie(self):

        elem = ElementOperations.Button(By.XPATH,
                                        self.cookieButtonXpath)._find()
        ElementOperations.Button(By.XPATH, self.cookieButtonXpath).click()
        return elem
Ejemplo n.º 13
0
 def uploadimage(self, img):
     logger.info("Trying to upload an image")
     ElementOperations.Button(By.XPATH, self.uploadImage).click()
     SystemActions.SysOperations().upload(img)
Ejemplo n.º 14
0
 def clickNext(self):
     logger.info("Trying to click NEXT button")
     ElementOperations.Button(By.XPATH, self.NextButton).click()
Ejemplo n.º 15
0
 def startGame(self):
     logger.info("Trying to click" + self.startXpath)
     ElementOperations.Button(By.XPATH, self.startXpath).click()
Ejemplo n.º 16
0
 def getText(self):
     logger.info("Trying to get text")
     text = ElementOperations.Button(By.XPATH, self.startXpath).getText()
     return text