Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 19a8e50

Browse files
committed
Update flight search examples
1 parent 6e4b5f5 commit 19a8e50

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

‎examples/cdp_mode/raw_elal.py‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1+
import datetime
12
import re
23
from seleniumbase import SB
34

45
with SB(uc=True, test=True, locale="en") as sb:
56
url = "www.elal.com/flight-deals/en-us/flights-from-boston-to-tel-aviv"
67
sb.activate_cdp_mode(url)
7-
sb.sleep(2)
8+
sb.sleep(3)
9+
sb.cdp.click('label:contains("Departure date")')
10+
sb.sleep(1)
11+
today = datetime.date.today()
12+
days_ahead = (4 - today.weekday() + 7) % 7
13+
next_friday = today + datetime.timedelta(days=days_ahead)
14+
formatted_date = next_friday.strftime("%m/%d/%Y")
15+
sb.cdp.gui_click_element('input[aria-describedby*="date-input"]')
16+
sb.sleep(1)
17+
sb.cdp.gui_press_keys("\b" * 10 + formatted_date + "\n")
18+
sb.sleep(1)
19+
sb.cdp.click('button[data-att="done"]')
20+
sb.sleep(1)
821
sb.cdp.click('button[data-att="search"]')
922
sb.sleep(5)
1023
sb.cdp.click_if_visible("#onetrust-close-btn-container button")

‎examples/cdp_mode/raw_southwest.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
cookie_pop_up = '[class*="PopOverContainer"] span'
88
if sb.cdp.is_element_visible(cookie_pop_up):
99
sb.cdp.mouse_click(cookie_pop_up)
10-
origin = "DEN"
11-
destination = "PHX"
10+
origin = "BOS"
11+
destination = "MDW"
1212
sb.cdp.gui_click_element("input#originationAirportCode")
1313
sb.sleep(0.5)
1414
sb.uc_gui_press_keys(" " + "\n")

‎examples/cdp_mode/raw_united.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
sb.activate_cdp_mode(url)
66
sb.sleep(2.5)
77
origin_input = 'input[placeholder="Origin"]'
8-
origin = "Boston, MA"
8+
origin = "New York, NY"
99
destination_input = 'input[placeholder="Destination"]'
10-
destination = "San Diego, CA"
10+
destination = "Orlando, FL"
1111
sb.cdp.gui_click_element(origin_input)
1212
sb.sleep(1.2)
1313
sb.cdp.type(origin_input, origin)
@@ -24,6 +24,7 @@
2424
sb.sleep(6)
2525
flights = sb.find_elements('div[class*="CardContainer__block"]')
2626
print("**** Flights from %s to %s ****" % (origin, destination))
27+
print(" (" + sb.get_text("h2.atm-c-heading") + ")")
2728
if not flights:
2829
print("* No flights found!")
2930
for flight in flights:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /