File tree 2 files changed +29
-12
lines changed
2 files changed +29
-12
lines changed Original file line number Diff line number Diff line change 4
4
url = "https://www.southwest.com/air/booking/"
5
5
sb .activate_cdp_mode (url )
6
6
sb .sleep (2.8 )
7
- cookie_pop_up = '[class*="PopOverContainer"] span'
8
- if sb .cdp .is_element_visible (cookie_pop_up ):
9
- sb .cdp .mouse_click (cookie_pop_up )
10
7
origin = "BOS"
11
8
destination = "MDW"
9
+ sb .cdp .click ("button#onetrust-accept-btn-handler" )
10
+ sb .sleep (0.5 )
12
11
sb .cdp .gui_click_element ("input#originationAirportCode" )
13
12
sb .sleep (0.5 )
14
13
sb .uc_gui_press_keys (" " + "\n " )
15
14
sb .sleep (0.5 )
16
15
sb .cdp .gui_click_element ("input#originationAirportCode" )
17
- sb .sleep (0.5 )
16
+ sb .sleep (0.4 )
18
17
sb .uc_gui_press_keys (origin + "\n " )
19
- sb .sleep (0.5 )
18
+ sb .sleep (0.4 )
20
19
sb .cdp .gui_click_element ("h1.heading" )
21
- sb .sleep (0.5 )
20
+ sb .sleep (0.3 )
22
21
sb .cdp .gui_click_element ("input#destinationAirportCode" )
23
- sb .sleep (0.5 )
22
+ sb .sleep (0.4 )
24
23
sb .uc_gui_press_keys (destination + "\n " )
25
- sb .sleep (0.5 )
24
+ sb .sleep (0.4 )
26
25
sb .cdp .gui_click_element ("h1.heading" )
27
- sb .sleep (0.5 )
26
+ sb .sleep (0.3 )
28
27
sb .cdp .click ('form button[aria-label*="Search"]' )
29
28
sb .sleep (4 )
30
29
day = sb .cdp .get_text ('[aria-current="true"] span[class*="cal"]' )
Original file line number Diff line number Diff line change 9
9
destination_input = 'input[placeholder="Destination"]'
10
10
destination = "Orlando, FL"
11
11
sb .cdp .gui_click_element (origin_input )
12
- sb .sleep (1.2 )
12
+ sb .sleep (0.5 )
13
13
sb .cdp .type (origin_input , origin )
14
14
sb .sleep (1.2 )
15
15
sb .cdp .click ('strong:contains("%s")' % origin )
16
16
sb .sleep (1.2 )
17
17
sb .cdp .gui_click_element (destination_input )
18
- sb .sleep (1.2 )
18
+ sb .sleep (0.5 )
19
19
sb .cdp .type (destination_input , destination )
20
20
sb .sleep (1.2 )
21
21
sb .cdp .click ('strong:contains("%s")' % destination )
28
28
if not flights :
29
29
print ("* No flights found!" )
30
30
for flight in flights :
31
- print ("* " + flight .text .split (" Destination" )[0 ])
31
+ flight_info = flight .text .split (" Destination" )[0 ]
32
+ part_1 = flight_info .split (" Departing at" )[0 ]
33
+ part_2 = flight_info .split ("Arriving at " )[- 1 ]
34
+ part_2 = part_2 .split (" Duration" )[0 ]
35
+ part_3 = flight .text .split (" Destination" )[- 1 ].split (" Aircraft" )[0 ]
36
+ parts = "%s - %s %s" % (part_1 , part_2 , part_3 )
37
+ print ("* " + parts )
38
+ for category in ["ECO-BASIC" , "ECONOMY" ]:
39
+ prices = sb .find_elements ('[aria-describedby="%s"]' % category )
40
+ full_prices = []
41
+ for item in prices :
42
+ item_text = item .text
43
+ if "Not available" not in item .text :
44
+ full_prices .append ("$%s" % item .text .split ("$" )[- 1 ])
45
+ else :
46
+ full_prices .append ("N/A" )
47
+ print ("**** %s Prices:" % category )
48
+ print (full_prices )
49
+ sb .cdp .scroll_down (50 )
32
50
sb .sleep (1.5 )
You can’t perform that action at this time.
0 commit comments