Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmintz committed Dec 30, 2024
1 parent 35dcd82 commit 11e81b0
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/cdp_mode/raw_easyjet.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
sb.cdp.click('[data-testid="month"]:last-of-type [aria-disabled="false"]')
sb.sleep(1.2)
sb.cdp.click('button[data-testid="submit"]')
sb.sleep(2.5)
sb.sleep(4.2)
sb.connect()
sb.sleep(1.2)
for window in sb.driver.window_handles:
Expand Down
1 change: 1 addition & 0 deletions examples/cdp_mode/raw_hyatt.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
info = hotel.text.strip()
if "Avg/Night" in info and not info.startswith("Rates from"):
name = info.split(" (")[0].split(" + ")[0].split(" Award Cat")[0]
name = name.split(" Rates from :")[0]
price = "?"
if "Rates from : " in info:
price = info.split("Rates from : ")[1].split(" Avg/Night")[0]
Expand Down
3 changes: 3 additions & 0 deletions examples/cdp_mode/raw_southwest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
url = "https://www.southwest.com/air/booking/"
sb.activate_cdp_mode(url)
sb.sleep(2.8)
cookie_pop_up = '[class*="PopOverContainer"] span'
if sb.cdp.is_element_visible(cookie_pop_up):
sb.cdp.mouse_click(cookie_pop_up)
origin = "DEN"
destination = "PHX"
sb.cdp.gui_click_element("input#originationAirportCode")
Expand Down
2 changes: 1 addition & 1 deletion examples/cdp_mode/raw_theaters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
url = "https://architectureofcities.com/roman-theaters"
sb.activate_cdp_mode(url)
sb.cdp.click_if_visible("#cn-close-notice")
sb.sleep(2)
sb.sleep(1)
print("*** " + sb.cdp.get_text("h1") + " ***")
for item in sb.cdp.find_elements("h3"):
if item.text and "." in item.text:
Expand Down
4 changes: 4 additions & 0 deletions examples/hack_the_planet.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ def test_all_your_base_are_belong_to_us(self):
self.set_text_content(".profile-preview-card button", "SeleniumBase")
if self.is_element_visible('h2 a[href*="simonh"]'):
self.set_text_content('h2 a[href*="simonh"]', aybabtu)
if self.is_element_visible('main h2 a[id*="article"]'):
self.set_text_content('main h2 a[id*="article"]', aybabtu)
self.highlight('[aria-label="Primary sidebar"] div div', scroll=False)
self.highlight('nav a[data-text="Relevant"]', loops=1, scroll=False)
self.highlight('nav a[data-text="Latest"]', loops=1, scroll=False)
Expand All @@ -124,6 +126,8 @@ def test_all_your_base_are_belong_to_us(self):
self.highlight('nav a[data-text="Infinity"]', loops=3, scroll=False)
if self.is_element_visible('h2 a[href*="simonh"]'):
self.highlight('h2 a[href*="simonh"]', loops=7, scroll=False)
if self.is_element_visible('main h2 a[id*="article"]'):
self.highlight('main h2 a[id*="article"]', loops=7, scroll=False)
self.highlight("section.crayons-card", loops=7, scroll=False)

self.open("https://azure.microsoft.com/en-us/services/playfab/")
Expand Down
1 change: 1 addition & 0 deletions examples/raw_ahrefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
sb.uc_click(submit_button, reconnect_time=3.25)
sb.uc_gui_click_captcha()
sb.wait_for_text_not_visible("Checking", timeout=11.5)
sb.click_if_visible('button[data-cky-tag="close-button"]')
sb.highlight('p:contains("github.com/seleniumbase/SeleniumBase")')
sb.highlight('a:contains("Top 100 backlinks")')
sb.set_messenger_theme(location="bottom_center")
Expand Down

0 comments on commit 11e81b0

Please sign in to comment.