Beispiel #1
0
 def findComment(self, comment_id):
     path = self.commentTextStart + str(comment_id) + self.commentTextEnd
     text = ElementOperations.Label(By.XPATH, path).getText()
     user = path + self.back
     string = ElementOperations.Label(By.XPATH, user).getAttr(self.id)
     id = re.findall(self.pattern, string)[0]
     return [text, id]
Beispiel #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']")
 def selectRandomCheckbox(self, num):
     logger.info("Trying to select a random checkbox")
     path = self.PreCheckboxXpath + self.Checkbox
     pathtext = self.PreCheckboxXpath + self.CheckboxText
     elems = ElementOperations.CheckBox(By.XPATH, path)._finds()
     x = gamePageLogic.Logic().ReturnValidCheckboxes(
         pathtext, elems, self.select, self.unselect)
     x = gamePageLogic.Logic().ClickCheckboxes(x, num)
     elem = ElementOperations.CheckBox(By.XPATH, self.CheckboxClick,
                                       x).random().click()
    def __init__(self):
        self.cookieButtonXpath = "//div[@class='align__cell']/button"
        self.HideHelpXpath = "//span[@class='discrete']"
        self.TimerXpath = "//div[@class='timer timer--white timer--center']"
        self.UnselectAll = "//label[@for='interest_unselectall']"
        self.PasswordFieldXpath = "//input[@placeholder='Choose Password']"
        self.EmailFieldXpath = "//input[@placeholder='Your email']"
        self.DomainFieldXpath = "//input[@placeholder='Domain']"
        self.DropDownField = "//div[@class='dropdown__field']"
        self.DropDownelements = "//div[@class='dropdown__list-item']"
        self.PreCheckboxXpath = "//div[@class='avatar-and-interests__interests-list__item']"
        self.Checkbox = "/div/span/label"
        self.StartCheckBox = "//span[@class='checkbox__box']"
        self.CheckboxClick = ""
        self.CheckboxText = "/div/span[not(@class)]"  #ansector::
        self.select = "Select all"
        self.unselect = "Unselect all"
        self.NextXpath = "//div[@class='align__cell button-container__secondary']/a[@class='button--secondary']"
        self.Checkboxes = "//div[@class='avatar-and-interests__interests-list__item']"
        self.NextButton = "//button[@class='button button--stroked button--white button--fluid']"
        self.uploadImage = "//a[@class='avatar-and-interests__upload-button']"
        self.cookiesDiv = "//div[@class='cookies']"
        self.HelpHidden = "//div[@class='help-form is-hidden']"
        self.Pageidentificator = "//div[@class='page-indicator']"
        self.Page1Text = "1 "
        self.Unic2 = "//p[@class='avatar-and-interests__text']"
        self.Unic3 = "//div[@class='personal-details']"
        self.Page2Text = "2 "
        self.Page3Text = "3 "
        self.Page4Text = "4 "

        self.elemGetText = ElementOperations.Label(By.XPATH, "Xpath here")
Beispiel #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 checkPage(self):

        text = ElementOperations.Label(By.XPATH,
                                       self.Pageidentificator).getText()
        result = gamePageLogic.Logic().GetPageNumber(text)

        return result
Beispiel #7
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
    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
 def getCheckboxText(self, locatorType, locator, elem):
     text = ElementOperations.CheckBox(locatorType, locator, elem).getText()
     return text
 def unselectCheckboxes(self):
     logger.info("Trying to click unselect all button")
     ElementOperations.CheckBox(By.XPATH, self.UnselectAll).click()
 def uploadimage(self, img):
     logger.info("Trying to upload an image")
     ElementOperations.Button(By.XPATH, self.uploadImage).click()
     SystemActions.SysOperations().upload(img)
 def findRandomCheckbox(self, x):
     elem = ElementOperations.CheckBox(By.XPATH, self.CheckboxClick,
                                       x).random()
     return elem
 def findTickets(self):
     logger.info("Trying to find list of tickets text")
     tickets = ElementOperations.ManyElements(
         locatorType="Xpath", locator=self.TicketTextXpath).find()
     return tickets
 def findStraightPath(self):
     logger.info("Trying to click 'Прямой' button")
     ElementOperations.Button(locatorType="Xpath",
                              locator=self.StraightTextXpath).click()
 def clickNext(self):
     logger.info("Trying to click NEXT button")
     ElementOperations.Button(By.XPATH, self.NextButton).click()
 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()
    def checkTimer(self):

        startTime = ElementOperations.Label(By.XPATH,
                                            self.TimerXpath).getText()
        return startTime
    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)
    def checkHelp(self):
        elem = ElementOperations.Form(By.XPATH, self.HelpHidden)._find()
        result = BaseForm(elem).isDisplayed()

        return result
 def removeHelp(self):
     elem = ElementOperations.Button(By.XPATH, self.HideHelpXpath)._find()
     ElementOperations.Button(By.XPATH, self.HideHelpXpath).click()
     return elem
    def removeCookie(self):

        elem = ElementOperations.Button(By.XPATH,
                                        self.cookieButtonXpath)._find()
        ElementOperations.Button(By.XPATH, self.cookieButtonXpath).click()
        return elem
Beispiel #23
0
 def chooseRandomDate(self):
     today = ElementOperations.OneElement(locatorType="Xpath", locator=self.CalendarDayToodayXpath).find()
     days = ElementOperations.ManyElements(locatorType="Xpath", locator=self.CalendarDayXpath).find()
     days.append(today)
     day = random.choice(days)
     return day
Beispiel #24
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
 def waitLoad(self):
     logger.info("Waiting for all results load")
     ElementOperations.Button("Xpath",
                              self.loaderAnimationFinishedXpath)._find()
Beispiel #26
0
 def findPostTextById(self, user_id, post_id):
     id = self.idPrefix + str(user_id) + "_" + str(post_id)
     text = ElementOperations.Label(By.ID, id).getText()
     return text
 def findDates(self):
     originDates = ElementOperations.ManyElements(
         locatorType="Xpath", locator=self.TicketOriginDateXpath).find()
     datesRE = TicketPageLogic.logic().onlyDay(originDates)
     return datesRE
Beispiel #28
0
 def clickLikeButton(self, post_id):
     path = self.partContainsDivClass + str(post_id) + self.closeAfterVar
     ElementOperations.Button(By.XPATH, path).click()
 def sendCreditalsDomain(self, passwd):
     ElementOperations.Input(By.XPATH, self.DomainFieldXpath).clear()
     ElementOperations.Input(By.XPATH, self.DomainFieldXpath).send(passwd)
 def wait3page(self):
     ElementOperations.Label(By.XPATH, self.Unic3)._find()