示例#1
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']")
    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
示例#3
0
 def sendCreditalsDomain(self, passwd):
     ElementOperations.Input(By.XPATH, self.DomainFieldXpath).clear()
     ElementOperations.Input(By.XPATH, self.DomainFieldXpath).send(passwd)
示例#4
0
    def sendCreditalsPassword(self, passwd):
        logger.info("Trying to generate string")

        ElementOperations.Input(By.XPATH, self.PasswordFieldXpath).clear()
        ElementOperations.Input(By.XPATH, self.PasswordFieldXpath).send(passwd)