def set_return_date(self, end_year, end_month, end_day):
     self.logger.info(
         f"Setting return date to {end_year}/{end_month}/{end_day}")
     self.driver.find_element(*SearchTransferLocators.return_date).click()
     current_year = get_datestamp(self.driver, SearchTransferLocators,
                                  ["datepicker_nav_title_years"])
     if current_year != end_year:
         self.driver.find_element(
             *SearchTransferLocators.datepicker_nav_title_end).click()
         self.driver.find_element(
             By.XPATH, f"//div[text()='{current_year}']").click()
         self.driver.find_element(
             By.XPATH, f"//div[contains(text(),'{end_year}')]").click()
     current_month = get_datestamp(self.driver, SearchTransferLocators,
                                   ["datepicker_nav_title_months"])
     if current_month[0:3] != end_month and current_year == end_year:
         self.driver.find_element(
             *SearchTransferLocators.datepicker_nav_title_end).click()
         months = self.driver.find_elements(
             By.XPATH, f"//div[contains(text(),'{end_month}')]")
         click_displayed_datestamp(months)
     if current_month[0:3] != end_month and current_year != end_year:
         months = self.driver.find_elements(
             By.XPATH, f"//div[contains(text(),'{end_month}')]")
         click_displayed_datestamp(months)
     days = self.driver.find_elements(
         By.XPATH, f"//div[contains(@class,'cell-day')]"
         f"[text()='{end_day}']")
     click_displayed_datestamp(days)
Пример #2
0
 def set_end_date(self, end_year, end_month, end_day):
     current_year = get_datestamp(self.driver, SearchFlightsFormLocators,
                                  ["datepicker_nav_title_years"])
     if current_year != end_year:
         self.driver.find_element(
             *SearchFlightsFormLocators.datepicker_nav_title_end).click()
         self.driver.find_element(
             By.XPATH, f"//div[text()='{current_year}']").click()
         self.driver.find_element(
             By.XPATH, f"//div[contains(text(),'{end_year}')]").click()
     current_month = get_datestamp(self.driver, SearchFlightsFormLocators,
                                   ["datepicker_nav_title_months"])
     if current_month[0:3] != end_month and current_year == end_year:
         self.driver.find_element(
             *SearchFlightsFormLocators.datepicker_nav_title_end).click()
         months = self.driver.find_elements(
             By.XPATH, f"//div[contains(text(),'{end_month}')]")
         click_displayed_datestamp(months)
     if current_month[0:3] != end_month and current_year != end_year:
         months = self.driver.find_elements(
             By.XPATH, f"//div[contains(text(),'{end_month}')]")
         click_displayed_datestamp(months)
     days = self.driver.find_elements(
         By.XPATH, f"//div[contains(@class,'cell-day')]"
         f"[text()='{end_day}']")
     click_displayed_datestamp(days)
Пример #3
0
 def set_date(self, start_year, start_month, start_day):
     self.driver.find_element(*SearchToursFormLocators.tour_date).click()
     current_year = get_datestamp(self.driver, SearchToursFormLocators,
                                  ["datepicker_nav_title_years"])
     if current_year != start_year:
         self.driver.find_element(
             *SearchToursFormLocators.datepicker_nav_title_start).click()
         self.driver.find_element(
             By.XPATH, f"//div[text()='{current_year}']").click()
         self.driver.find_element(
             By.XPATH, f"//div[contains(text(),'{start_year}')]").click()
     current_month = get_datestamp(self.driver, SearchToursFormLocators,
                                   ["datepicker_nav_title_months"])
     if current_month[0:3] != start_month:
         self.driver.find_element(
             By.XPATH, f"//div[contains(@class,'cell-month')]"
             f"[contains(.,'{start_month}')]").click()
     days = self.driver.find_elements(
         By.XPATH, f"//div[contains(@class,'cell-day')]"
         f"[text()='{start_day}']")
     click_displayed_datestamp(days)