def enter_random_hotel_or_city():
    current_browser.find_element_by_class_name(buttons['hotel/city']).click()
    current_browser.find_element_by_xpath(buttons['hotel/city_clicked']).send_keys(
        locations_hotels[randint(0, len(locations_hotels)-1)]
    )
    search_result = current_browser.find_element_by_xpath("//span[@class='select2-match']")
    search_result.click()
def checkin_datepicker_select_tomorrow():
    current_browser.find_element_by_name(buttons['checkin']).click()
    if current_browser.find_element_by_xpath("//td[@class='day ']").size() != 0:
        future_day_button = current_browser.find_element_by_xpath("//td[@class='day ']")
        future_day_button.click()
    else:
        today_button = current_browser.find_element_by_xpath("//td[@class='day  active']")
        today_button.click()
def checkin_datepicker_select_random_future_date():
    current_browser.find_element_by_name(buttons['checkin']).click()
    date_range_switcher = current_browser.find_element_by_xpath(
        "//div[@class='datepicker dropdown-menu'][1]/div[@class='datepicker-days']//th[@class='switch']"
    )
    date_range_switcher.click()
    next_button = current_browser.find_element_by_xpath(
        "//div[@class='datepicker dropdown-menu'][1]/div[@class='datepicker-months']//th[@class='next']"
    )
    for i in range(randint(1, 6)):
        next_button.click()
    first_month = current_browser.find_element_by_xpath(
        "//div[@class='datepicker dropdown-menu']/div[@class='datepicker-months']//span[@class='month']"
    )
    first_month.click()
def checkout_select_random_future():
    try:  # This path expects that the checkout date dropdown is opened (this can occure easily).
        date_range_switcher = current_browser.find_element_by_xpath(
            "//div[@class='datepicker dropdown-menu'][2]/div[@class='datepicker-days']//th[@class='switch']"
        )
        date_range_switcher.click()
    except ElementNotVisibleException:  # This path does NOT expect that the checkout date dropdown is opened.
        current_browser.find_element_by_name(buttons['checkout']).click()
        date_range_switcher = current_browser.find_element_by_xpath(
            "//div[@class='datepicker dropdown-menu'][2]/div[@class='datepicker-days']//th[@class='switch']"
        )
        date_range_switcher.click()

    next_button = current_browser.find_element_by_xpath(
        "//div[@class='datepicker dropdown-menu'][2]/div[@class='datepicker-months']//th[@class='next']"
    )
    for k in range(randint(1, 5)):
        next_button.click()

    first_month = current_browser.find_element_by_xpath(
        "//div[@class='datepicker dropdown-menu'][2]/div[@class='datepicker-months']//span[@class='month']"
    )
    first_month.click()
def checkin_datepicker_select_today():
    current_browser.find_element_by_name(buttons['checkin']).click()
    today_button = current_browser.find_element_by_xpath("//td[@class='day  active']")
    today_button.click()
def enter_custom_hotel_or_city(custom_destination):
    current_browser.find_element_by_class_name(buttons['hotel/city']).click()
    current_browser.find_element_by_xpath(buttons['hotel/city_clicked']).send_keys(custom_destination)
    search_result = current_browser.find_element_by_xpath("//span[@class='select2-match']")
    search_result.click()
def select_search_button():
    current_browser.find_element_by_xpath(buttons['search']).click()