webscraping

import random
import time
fact_1 = 'There are around 7,000 flights in the air at any one time'
fact_2 = 'There are no less than 20 flights per day between New York and London'
fact_3 = "More than a million people fly the world's busiest domestic air route every month"
fact_4 = "The average flight travels at 35,000 feet That's about seven miles above the surface of the Earth."
fact_5 = "The temperature outside your plane is - 51°C.\n Don't even think about opening the window"
fact_6 = 'You have heard about olives and pilots eating separate meals. \n But did you know that Singapore Airlines spends $700 million on food every year? \n $16 million is spent on wine alone. '
fact_7 = 'airlines have to be careful with the food they give you. Your taste-buds act differently on a plane due to pressure changes. \n For example, you can’t taste salty things that well.'
fact_8 = "The victorious Boeing 747 (RIP, Airbus A380) jumbo jet is made up of six million parts and 240-280 kilometers of wires. \n No surprise that airline maintenance is such a sticky issue."
fact_9 = "The Soviet An-2 biplane has the longest production run (1947-2001) of any plane and is the most mass-produced (18,000+ built) air transport.\n You can still fly one today – people love operating them in rugged conditions."
fact_10= "planes going in for a landing often set their engines to 'flight idle,' where they’re operating, but not providing the push. \n Therefore, when the plane is landing, the engines can all die without affecting anything."
fact_11= 'The tail rotor on a helicopter is there to prevent the main rotor from spinning the hull in place. \n  Unlike an An-2, a helicopter thirsts for your blood.'
fact_12= 'At 12% humidity, the air in an airplane cabin is drier than most deserts.\n Stay hydrated! It’s also colder than most deserts, but I’m sure you noticed that already.'
fact_13= "Passengers account only for about 10% of the plane’s take-off weight. Fuel takes the biggest part."
fact_14= "For various good reasons (cheeky smokers being one of them), airplane lavatories can be unlocked from the outside."
fact_15= "Qantas invented business class in 1979, but many other airlines were experimenting with creating something between first and economy classes.\n Currently, airlines are working on inventing a class below the economy."


facts=(fact_1, fact_2, fact_3,fact_4,fact_5,fact_6,fact_7,fact_8,fact_9,fact_10,fact_11,fact_12,fact_13,fact_14,fact_15)

print("Sorry for the delay , Here's a fun fact")
time.sleep(1)
print (random.choice(facts))
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

PATH = "C:\Program Files\chromedriver.exe"
driver = webdriver.Chrome(PATH)

dept = input('Enter Airport of Departure: ')
arr = input('Enter Airport of Arrival: ')
date = input('Enter Date of Departure(dd): ')
month = input('Enter Month(mm): ')
year = input('Enter Year(yyyy): ')

time.sleep(2)

print('Starting auto query submission.....')
print('')

print('Filling in the details.....')
print('')
driver.get(f"https://reservationsma.airarabia.com/service-app/ibe/reservation.html#/fare/en/AED/ae/{dept.upper()}/{arr.upper()}/{date}-{month}-{year}/N/1/0/0/Y//N/N")
time.sleep(5)
try:
       cost = driver.find_element_by_xpath('/html/body/div[1]/div[4]/div/div/div[1]/section/div/div[1]/div/ul/li[5]/div/div/span[4]/span[2]')
       time.sleep(2)
       time1 = driver.find_element_by_xpath('//*[@id="flight-options"]/div[3]/isa-flight-select/div[5]/div[1]/div[1]/label')
       time.sleep(2)
       time2 = driver.find_element_by_xpath('//*[@id="flight-options"]/div[3]/isa-flight-select/div[5]/div[1]/div[3]/label')
       time.sleep(2)

       print('')
       print('----------------X----------------X----------------')
       print('')
       print('The shortest flight:')
       print('')
       print(f"{dept.upper()}  {time1.text}------>{time2.text}  {arr.upper()}")
       print('Reminder no connecting flight')

       print('')
       print('----------------X----------------X----------------')
       print('')
       print('The cheapest flight:')
       print('')

       print('')
       print('Air-arabia will cost you AED:', cost.text)
       print('')
       print('----------------X----------------X----------------')

except:
       print('')
       print('')
       print('Sorry no flights are available')
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import graphelements
import tableelements



def Emirates(dept, arr, day, month, year):
    PATH = "C:\Program Files (x86)\chromedriver.exe"
    driver = webdriver.Chrome(PATH)

    driver.get("https://fly2.emirates.com/CAB/IBE/SearchAvailability.aspx")

    time.sleep(3)

    search = driver.find_element_by_class_name("ts-session-expire--link")

    search.click()

    print('')
    print('----------------X----------------X----------------')
    print('EMIRATES')
    print('----------------X----------------X----------------')

    print('Starting auto query submission.....')
    print('')

    search1 = driver.find_element_by_id("dvRadioOneway").click()

    departure = driver.find_element_by_id("ctl00_c_CtWNW_ddlFrom-suggest")

    departure.send_keys(dept.upper())


    print('Filling in the details.....')
    print('')

    arrival = driver.find_element_by_id("ctl00_c_CtWNW_ddlTo-suggest")

    arrival.send_keys(arr.upper())

    date = driver.find_element_by_id("txtDepartDate")

    date.click()

    date1 = driver.find_element_by_id(
        f"day-{day}-{str(int(month) - 1)}-{year}")

    date1.click()

    fsearch = driver.find_element_by_id("ctl00_c_IBE_PB_FF")

    fsearch.click()

    time.sleep(2)


    print('Data submitted.....')
    print('')


    try:

        print('Retrieving output.....')

        time.sleep(2)

        cost = driver.find_element_by_class_name("summary-curr-only")

        time1 = driver.find_element_by_class_name("ts-fie__departure")

        time2 = driver.find_element_by_class_name("ts-fie__arrival")

        currency = driver.find_element_by_id("ltViewPricesIn")

        currency = currency.find_element_by_tag_name("strong")

        stops = driver.find_element_by_id("ctl00_c_FlightResultOutBound_rptBoundResult_ctl00_aFlightDetails")

        stops = stops.find_element_by_tag_name("span")

        print('')
        print('----------------X----------------X----------------')
        print('')
        print('The shortest flight:')
        print('')
        print(f"{dept.upper()}  {time1.text}------>{time2.text}  {arr.upper()}")
        print('')
        print(stops.text)
        print('')
        print('----------------X----------------X----------------')
        print('')
        print('The cheapest flight:')
        print('')
        print('It will cost you', cost.text, currency.text)

        costs = ''.join(i for i in cost.text if i.isdigit())
        graphelements.pick('Emirates', int(costs))

        tableelements.pick(['Emirates', costs, 'Inflight entertainment, complimentary kit etc.'])

    except:
        print('----------------X----------------X----------------')
        print('')
        print('Sorry no flights are available')
        print('')
        print('----------------X----------------X----------------')

    time.sleep(3)
    driver.quit()

def Callemirates(dept, arr, day, month, year):
    PATH = "C:\Program Files (x86)\chromedriver.exe"
    driver = webdriver.Chrome(PATH)

    time.sleep(2)
    driver.get("https://fly2.emirates.com/CAB/IBE/SearchAvailability.aspx")

    time.sleep(3)

    search = driver.find_element_by_class_name("ts-session-expire--link")

    search.click()

    search1 = driver.find_element_by_id("dvRadioOneway").click()

    departure = driver.find_element_by_id("ctl00_c_CtWNW_ddlFrom-suggest")

    departure.send_keys(dept.upper())

    arrival = driver.find_element_by_id("ctl00_c_CtWNW_ddlTo-suggest")

    arrival.send_keys(arr.upper())

    date = driver.find_element_by_id("txtDepartDate")

    date.click()

    date1 = driver.find_element_by_id(
        f"day-{day}-{str(int(month) - 1)}-{year}")

    date1.click()

    fsearch = driver.find_element_by_id("ctl00_c_IBE_PB_FF")

    fsearch.click()
    time.sleep(200)
from selenium import webdriver
import time
import graphelements
import tableelements


def Etihad(dept, arr, date, month, year):
    PATH = "C:\Program Files (x86)\chromedriver.exe"
    driver = webdriver.Chrome(PATH)

    driver.get(
        f"https://dxbooking.etihad.com/dx/EYDX/#/flight-selection?journeyType=one-way&locale=en-GB&class=Economy&ADT=1&CHD=0&INF=0&origin={dept.upper()}&destination={arr.upper()}&date={month}-{date}-{year}&searchType=BRANDED&direction=0&execution=e2s1")
    time.sleep(4)

    print('')
    print('----------------X----------------X----------------')
    print('ETIHAD')
    print('----------------X----------------X----------------')

    print('Starting auto query submission.....')
    print('')

    print('Filling in the details.....')
    print('')

    print('Data submitted.....')
    print('')

    time.sleep(3)

    try:

        time.sleep(3)
        costs = driver.find_element_by_xpath(
            '/html/body/div[2]/div/div[2]/div/div/div/div[1]/div[2]/div[2]/div/div/div[2]/div[2]/div[2]/div/div/div/div[1]/div/div[4]/button/div[2]/span[1]/span/span/span/span')

        print('Retrieving output.....')
        time.sleep(1)
        time1 = driver.find_element_by_xpath(
            '//*[@id="dxp-flight-table-section"]/div[2]/div/div[1]/div[1]/div/div/div[1]/div[1]/div[1]/time')

        time2 = driver.find_element_by_xpath(
            '//*[@id="dxp-flight-table-section"]/div[2]/div/div[1]/div[1]/div/div/div[1]/div[2]/div[1]/time')

        stops = driver.find_element_by_class_name("duration-stops")

        print('----------------X----------------X----------------')
        print('')
        print('The shortest flight:')
        print('')
        print(f"{dept.upper()}  {time1.text}------>{time2.text}  {arr.upper()}")
        print('')
        print(stops.text)

        print('')
        print('----------------X----------------X----------------')
        print('')
        print('The cheapest flight:')
        print('')
        print('Etihad airways will cost you', costs.text)
        print('')
        print('----------------X----------------X----------------')

        cost = ''.join(i for i in costs.text if i.isdigit())
        graphelements.pick('Etihad', int(cost))

        tableelements.pick(['Etihad', cost, 'Inflight entertainment, complimentary food and drink etc.'])
    except:
        print('----------------X----------------X----------------')
        print('')
        print('Sorry no flights are available')
        print('')
        print('----------------X----------------X----------------')

    time.sleep(3)
    driver.quit()

def Calletihad(dept, arr, date, month, year):
    PATH = "C:\Program Files (x86)\chromedriver.exe"
    driver = webdriver.Chrome(PATH)

    time.sleep(2)
    driver.get(f"https://dxbooking.etihad.com/dx/EYDX/#/flight-selection?journeyType=one-way&locale=en-GB&class=Economy&ADT=1&CHD=0&INF=0&origin={dept.upper()}&destination={arr.upper()}&date={month}-{date}-{year}&searchType=BRANDED&direction=0&execution=e2s1")
    time.sleep(200)
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import graphelements
import tableelements


def Airindiaexpress(dept, arr, date, month, year):
    PATH = "C:\Program Files (x86)\chromedriver.exe"
    driver = webdriver.Chrome(PATH)

    print('')
    print('----------------X----------------X----------------')
    print('AIR INDIA EXPRESS')
    print('----------------X----------------X----------------')

    print('Starting auto query submission.....')
    print('')

    print('Filling in the details.....')
    print('')

    driver.get(f'https://www.airindiaexpress.in/en/Flight/Search?interline=false&fromCityCode={dept.upper()}&toCityCode={arr.upper()}&departureDateString={year}-{month}-{date}&returnDateString={str(int(year)+1)}-10-14&adults=1&children=0&infants=0&roundTrip=false&useFlexDates=true&allInclusive=&promocode=&fareTypes=&currency=AED')

    print('Data submitted.....')
    print('')

    try:

        print('Retrieving output.....')

        time.sleep(2)
        cost = driver.find_element_by_class_name('css-radio-label')

        time.sleep(2)
        time1 = driver.find_element_by_xpath('//*[@id="accordion_outbound"]/div/div[1]/div[2]')

        time.sleep(2)
        time2 = driver.find_element_by_xpath('//*[@id="accordion_outbound"]/div/div[1]/div[3]')

        print('')
        print('----------------X----------------X----------------')
        print('')
        print('The shortest flight:')
        print('')
        print(f"{dept.upper()}  {time1.text}------>{time2.text}  {arr.upper()}")
        print('')
        print('No Connecting Flights')
        print('')
        print('----------------X----------------X----------------')
        print('')
        print('Air India Express- will cost you', cost.text)
        print('')
        print('----------------X----------------X----------------')

        costs = ''.join(i for i in cost.text if i.isdigit() or i == '.')
        graphelements.pick('Air India Express', int(float(costs)))

        tableelements.pick(['Air India Express', costs, 'Complimentary snacks, tea / coffee on board'])
    except:
        print('----------------X----------------X----------------')
        print('')
        print('Sorry no flights are available')
        print('')
        print('----------------X----------------X----------------')

    time.sleep(4)
    driver.quit()


def Callairindiaexpress(dept, arr, date, month, year):
    PATH = "C:\Program Files (x86)\chromedriver.exe"
    driver = webdriver.Chrome(PATH)

    time.sleep(2)
    driver.get(f'https://www.airindiaexpress.in/en/Flight/Search?interline=false&fromCityCode={dept.upper()}&toCityCode={arr.upper()}&departureDateString={year}-{month}-{date}&returnDateString={str(int(year)+1)}-10-14&adults=1&children=0&infants=0&roundTrip=false&useFlexDates=true&allInclusive=&promocode=&fareTypes=&currency=AED')
    time.sleep(200)
from selenium import webdriver
import time
import graphelements
import tableelements


def Britishairways(dept, arr, date, month, year):
    PATH = "C:\Program Files (x86)\chromedriver.exe"
    driver = webdriver.Chrome(PATH)

    driver.get(
        f"https://www.britishairways.com/travel/booking/public/en_ae/#/flightList?origin={dept.upper()}&destination={arr.upper()}&outboundDate={year}-{month}-{date}&adultCount=1&youngAdultCount=0&childCount=0&infantCount=0&cabin=M&ticketFlexibility=LOWEST&journeyType=OWFLT&source=false")
    time.sleep(4)

    print('')
    print('----------------X----------------X----------------')
    print('BRITISH AIRWAYS')
    print('----------------X----------------X----------------')

    print('Starting auto query submission.....')
    print('')

    print('Filling in the details.....')
    print('')

    print('Data submitted.....')
    print('')

    time.sleep(3)

    try:

        time.sleep(3)
        costs = driver.find_element_by_xpath('//*[@id="container"]/div/div[1]/div[2]/div[1]/ul/li[5]/div/p[2]')

        print('Retrieving output.....')

        tim1 = driver.find_element_by_class_name("departure")

        time1 = tim1.find_element_by_tag_name("span")

        tim2 = driver.find_element_by_class_name("arrival")

        time2 = tim2.find_element_by_tag_name("span")

        stop = driver.find_element_by_class_name("flight-duration-container")
        stops = stop.find_elements_by_tag_name("p")

        print('----------------X----------------X----------------')
        print('')
        print('The shortest flight:')
        print('')
        print(f"{dept.upper()}  {time1.text}------>{time2.text}  {arr.upper()}")
        print('')
        for val in stops:
            print(val.text)
            print('')
        print('')
        print('----------------X----------------X----------------')
        print('')
        print('The cheapest flight:')
        print('')
        print('British airways will cost you', costs.text)
        print('')
        print('----------------X----------------X----------------')

        cost = ''.join(i for i in costs.text if i.isdigit())
        graphelements.pick('British Airways', int(cost))

        tableelements.pick(['British Airways', cost, 'Inflight entertainment, complimentary amenity kit etc.' ])

    except:
        print('----------------X----------------X----------------')
        print('')
        print('Sorry no flights are available')
        print('')
        print('----------------X----------------X----------------')

    time.sleep(3)
    driver.quit()


def Callbritishairways(dept, arr, date, month, year):
    PATH = "C:\Program Files (x86)\chromedriver.exe"
    driver = webdriver.Chrome(PATH)

    time.sleep(2)
    driver.get(f"https://www.britishairways.com/travel/booking/public/en_ae/#/flightList?origin={dept.upper()}&destination={arr.upper()}&outboundDate={year}-{month}-{date}&adultCount=1&youngAdultCount=0&childCount=0&infantCount=0&cabin=M&ticketFlexibility=LOWEST&journeyType=OWFLT&source=false")
    time.sleep(200)
import tkinter as tk

Height = 300
Width = 500

data = []
def guidept(entry):
    data.append(entry)

def guiarr(entry):
    data.append(entry)

def guidate(entry):
    data.append(entry)

def guimonth(entry):
    data.append(entry)

def guiyear(entry):
    data.append(entry)

def close_window():
    root.destroy()

root = tk.Tk()

canvas = tk.Canvas(root, height=Height, width=Width)
canvas.pack()

frame = tk.Frame(root, bg='#172a4f')
frame.place(relheight=0.75, relwidth=2, anchor='n')

entry1 = tk.Entry(frame, bg='#f4f4f4', borderwidth=3, relief="sunken", font=("Rockwell", "16"))
entry1.place(relx=0.63, relwidth=0.22, rely=0.3, relheight=0.27, anchor='center')

entry1.delete(0, tk.END)
entry1.insert(0, 'Enter the departure')

entry2 = tk.Entry(frame, bg='#f4f4f4', borderwidth=3, relief="sunken", font=("Rockwell", "16"))
entry2.place(relx=0.87, relwidth=0.22, rely=0.3, relheight=0.27, anchor='center')

entry2.delete(0, tk.END)
entry2.insert(0, 'Enter the arrival')

entry3 = tk.Entry(frame, bg='#f4f4f4', borderwidth=3, relief="sunken", font=("Rockwell", "11"))
entry3.place(relx=0.59, relwidth=0.15, rely=0.7, relheight=0.25, anchor='center')

entry3.delete(0, tk.END)
entry3.insert(0, 'Enter the date(dd)')

entry4 = tk.Entry(frame, bg='#f4f4f4', borderwidth=3, relief="sunken", font=("Rockwell", "11"))
entry4.place(relx=0.75, relwidth=0.15, rely=0.7, relheight=0.25, anchor='center')

entry4.delete(0, tk.END)
entry4.insert(0, 'Enter the month(mm)')

entry5 = tk.Entry(frame, bg='#f4f4f4', borderwidth=3, relief="sunken", font=("Rockwell", "11"))
entry5.place(relx=0.91, relwidth=0.15, rely=0.7, relheight=0.25, anchor='center')
entry5.delete(0, tk.END)
entry5.insert(0, 'Enter the year(yyyy)')
button = tk.Button(root, text='SUBMIT', bg='#f6cd13', fg='white', font=("Rockwell", "20"), command=lambda: [guidept(entry1.get()), guiarr(entry2.get()), guidate(entry3.get()), guimonth(entry4.get()), guiyear(entry5.get()), close_window()])
button.place(rely=1, relx=0.5, relwidth=1, relheight=0.25, anchor='s')


root.mainloop()
import Emirates
import Etihad
import Airarabia
import Airindiaexpress
import Britishairways
import Flydubai
import time
from testfact import facts
import random
import matplotlib.pyplot as plt
from graphelements import flights
from graphelements import price
import tableelements
import guitrial


dept = guitrial.data[0]
arr = guitrial.data[1]
date = guitrial.data[2]
month = guitrial.data[3]
year = guitrial.data[4]


print('')
print('We have:-')
print('1. Emirates')
print('2. Etihad')
print('3. Air Arabia')
print('4. Air India Express')
print('5. British Airways')
print('6. Fly Dubai')
print('')
single_multi = input("Do you want to see the data of all the flights?(y/n): ")

if single_multi.lower() == 'n':

    print("Which one...")
    print("Type 1 for Emirates")
    print("Type 2 for Etihad")
    print("Type 3 for Air Arabia")
    print("Type 4 for Air India Express")
    print("Type 5 for British Airways")
    print("Type 6 for Fly Dubai")
    print('')
    flight_selector = input("Select a flight: ")

    if flight_selector == '1':

        Emirates.Emirates(dept, arr, date, month, year)
        print('')

        if input("Do you want to check out this flight?(y/n): ") == 'y':
            Emirates.Callemirates(dept, arr, date, month, year)

    elif flight_selector == '2':

        Etihad.Etihad(dept, arr, date, month, year)
        print('')

        if input("Do you want to check out this flight?(y/n): ") == 'y':
            Etihad.Calletihad(dept, arr, date, month, year)

    elif flight_selector == '3':

        Airarabia.Airarabia(dept, arr, date, month, year)
        print('')

        if input("Do you want to check out this flight?(y/n): ") == 'y':
            Airarabia.Callairarabia(dept, arr, date, month, year)

    elif flight_selector == '4':

        Airindiaexpress.Airindiaexpress(dept, arr, date, month, year)
        print('')

        if input("Do you want to check out this flight?(y/n): ") == 'y':
            Airindiaexpress.Callairindiaexpress(dept, arr, date, month, year)

    elif flight_selector == '5':

        Britishairways.Britishairways(dept, arr, date, month, year)
        print('')

        if input("Do you want to check out this flight?(y/n): ") == 'y':
            Britishairways.Callbritishairways(dept, arr, date, month, year)

    elif flight_selector == '6':

        Flydubai.Flydubai(dept, arr, date, month, year)
        print('')

        if input("Do you want to check out this flight?(y/n): ") == 'y':
            Flydubai.Callflydubai(dept, arr, date, month, year)
            print('')

    else:
        print("Wrong input please try again")
elif single_multi.lower() == 'y':
    print('Collecting data ... this may take some time.....')
    print('')
    print('')
    print("Sorry for the delay , Here's a fun fact")
    print('')
    time.sleep(2)
    print(random.choice(facts))
    time.sleep(2)

    Emirates.Emirates(dept, arr, date, month, year)
    print('')
    print('')
    Etihad.Etihad(dept, arr, date, month, year)
    print('')
    print('')
    Airarabia.Airarabia(dept, arr, date, month, year)
    print('')
    print('')
    Airindiaexpress.Airindiaexpress(dept, arr, date, month, year)
    print('')
    print('')
    Britishairways.Britishairways(dept, arr, date, month, year)
    print('')
    print('')
    Flydubai.Flydubai(dept, arr, date, month, year)
    print('')
    print('')
    print('')

    print(':        Name        :    Cost    :                          Amenities                          :')

    for item in tableelements.data:
        print(':', item[0], " " * (17 - len(item[0])), ':', item[1], " " * (9 - len(str(item[1]))), ':', item[2],
              " " * (58 - len(str(item[2]))), ":")

    plt.bar(flights, price, color='#153282', edgecolor='#e63d1c')
    plt.title('Compare The Costs')
    plt.ylabel('Cost')
    plt.show()
else:
    print("Wrong input please try again")
flights = []
price = []


def pick(airline, val):
    flights.append(airline)
    price.append(val)
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import graphelements
import tableelements


def Flydubai(dept, arr, date, month, year):
    PATH = "C:\Program Files (x86)\chromedriver.exe"
    driver = webdriver.Chrome(PATH)

    print('')
    print('----------------X----------------X----------------')
    print('FLY DUBAI')
    print('----------------X----------------X----------------')

    print('Starting auto query submission.....')
    print('')

    print('Filling in the details.....')
    print('')

    driver.get(
        f'https://flights2.flydubai.com/en/results/ow/a1/{dept.upper()}_{arr.upper()}/{year}{month}{date}?cabinClass=Economy&isOriginMetro=true&isDestMetro=false&pm=cash')

    print('Data submitted.....')
    print('')

    try:

        print('Retrieving output.....')

        time.sleep(2)
        cost = driver.find_element_by_xpath('//*[@id="flight-fare-label"]')

        time.sleep(2)
        time1 = driver.find_element_by_xpath(
            '/html/body/fz-root/div[1]/div[1]/fz-availability/fz-desktop-availability/div/div[2]/div[1]/div/fz-desktop-availability-list/div/div/div/div/fz-desktop-flight-availability-list-item/div/div/div/div/div[1]/fz-station-code-time/div/div[1]/fz-date-core/div/p')

        time.sleep(2)
        time2 = driver.find_element_by_xpath(
            '/html/body/fz-root/div[1]/div[1]/fz-availability/fz-desktop-availability/div/div[2]/div[1]/div/fz-desktop-availability-list/div/div/div/div/fz-desktop-flight-availability-list-item/div/div/div/div/div[3]/div/fz-station-code-time/div/div[1]/fz-date-core/div/p')

        time.sleep(2)
        duration = driver.find_element_by_xpath(
            '/html/body/fz-root/div[1]/div[1]/fz-availability/fz-desktop-availability/div/div[2]/div[1]/div/fz-desktop-availability-list/div/div/div/div/fz-desktop-flight-availability-list-item/div/div/div/div/div[2]/div[1]/fz-static-label/label')

        print('----------------X----------------X----------------')
        print('')
        print('The shortest flight:')
        print('')
        print(f"{dept.upper()}  {time1.text}------>{time2.text}  {arr.upper()}")
        print('')
        print(f'Duration of Flight {duration.text}')
        print('')
        print('----------------X----------------X----------------')
        print('')
        print('The cheapest flight:')
        print('')
        print('Fly Dubai - will cost you', cost.text)
        print('')
        print('----------------X----------------X----------------')

        costs = ''.join(i for i in cost.text if i.isdigit() or i == '.')
        graphelements.pick('Fly Dubai', int(float(costs)))

        tableelements.pick(['Fly dubai', costs, 'Wi-Fi, complimentary food and drink etc.'])

    except:
        print('----------------X----------------X----------------')
        print('')
        print('Sorry no flights are available')
        print('')
        print('----------------X----------------X----------------')

    time.sleep(3)
    driver.quit()


def Callflydubai(dept, arr, date, month, year):
    PATH = "C:\Program Files (x86)\chromedriver.exe"
    driver = webdriver.Chrome(PATH)

    time.sleep(2)
    driver.get(f'https://flights2.flydubai.com/en/results/ow/a1/{dept.upper()}_{arr.upper()}/{year}{month}{date}?cabinClass=Economy&isOriginMetro=true&isDestMetro=false&pm=cash')
    time.sleep(200)

Similiar Collections