def set_seats(driver): available_seats = len( SeatingPageUtil.get_seating_available_seats(driver)) random_position = random.choice(range(0, available_seats)) for index in range(0, adults + children): wait_click( driver, css_select=SeatingPageLocators.seating_page_available_seats, index=random_position)
def set_departure_date(driver): all_dates = wait_for_elements( driver, css_select=HomePageLocators.home_page_calendar_dates) # I'm removing today's date available_dates = [ x for x in all_dates if HomePageLocators.home_page_calender_date_disabled not in x.get_attribute('class') ][1:] selected_date = random.choice(available_dates) wait_click(driver, css_select=HomePageLocators.home_page_calendar_dates, index=all_dates.index(selected_date))
def set_adults_passengers(driver): all_passenger_types = [ x for x in wait_for_elements( driver, css_select=HomePageLocators.home_page_passenger_type) ] adult_passenger = [ x for x in all_passenger_types if HomePageLocators.home_page_adult_passenger in x.get_attribute( 'data-ref') ][0] for i in range(1, adults): wait_click( driver, css_select=HomePageLocators.home_page_passenger_counter_button, index=all_passenger_types.index(adult_passenger))
def set_flight_fare(driver): wait_click(driver, css_select=FlightPageLocators.flight_page_flight_fare)
def set_bag_page_continue_button(driver): wait_click(driver, css_select=BagPageLocators.bag_continue_button)
def set_bag_selection(driver): # index=0 no bags wait_click(driver, css_select=BagPageLocators.bag_selection)
def set_currency_dropdown_item(driver): wait_click(driver, css_select=PaymentPageLocators.payment_dropdown_items, index=1)
def set_passenger_confirm_button(driver): wait_click( driver, css_select=HomePageLocators.home_page_passenger_confirm_button)
def set_passenger_title(driver): for index in range(0, adults): FlightPageUtil.set_passenger_title_dropdwon(driver, index=index) dropdown_items = wait_for_elements(driver, css_select=FlightPageLocators.flight_page_passenger_title_items) wait_click(driver, css_select=FlightPageLocators.flight_page_passenger_title_items, index=random.choice(range(0, len(dropdown_items))))
def set_cc_expiration_month_and_year(driver): expiration_dropdown_menus = PaymentPageUtil.get_expiration_dropdowns(driver) for index in range(0, len(expiration_dropdown_menus)): wait_click(driver, css_select=PaymentPageLocators.payment_expiration_dropdowns, index=index) random_item = random.choice(range(0, len(PaymentPageUtil.get_dropdown_items(driver)))) wait_click(driver, css_select=PaymentPageLocators.payment_dropdown_items, index=random_item)
def set_insurance(driver): wait_click(driver, css_select=PaymentPageLocators.insurance_button)
def set_log_in_button(driver): wait_click(driver, css_select=PaymentPageLocators.log_in_button)
def set_flight_airport(driver): wait_click(driver, css_select=HomePageLocators.home_page_flight_airport)
def set_cookie_popup(driver): wait_click(driver, css_select=HomePageLocators.home_page_cookie_popup)
def set_login_later(driver): wait_click(driver, css_select=FlightPageLocators.flight_page_login_later)
def set_terms_and_conditions(driver): wait_click(driver, css_select=PaymentPageLocators.terms_and_conditions)
def set_passenger_title_dropdwon(driver, index): wait_click(driver, css_select=FlightPageLocators.flight_page_passenger_title_dropdown, index=index)
def set_pay_now_button(driver): wait_click(driver, css_select=PaymentPageLocators.pay_now_button)
def set_seating_modal(driver): wait_click(driver, css_select=SeatingPageLocators.seating_page_modal)
def set_currency_dropdown_menu(driver): wait_click(driver, css_select=PaymentPageLocators.currency_dropdown)
def set_seating_continue_button(driver): wait_click(driver, css_select=SeatingPageLocators.seating_page_continue_button)
def set_extras_final_page_basket(driver): wait_click(driver, css_select=ExtrasPageLocators.extras_page_basket)