From 1b02e839e7d202b451bb66addde78f83a805c625 Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Fri, 7 Mar 2025 11:02:08 -0500 Subject: [PATCH] Update examples --- examples/cdp_mode/raw_chatgpt.py | 5 +++-- examples/cdp_mode/raw_elal.py | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/cdp_mode/raw_chatgpt.py b/examples/cdp_mode/raw_chatgpt.py index fd67456c..76ba7c57 100644 --- a/examples/cdp_mode/raw_chatgpt.py +++ b/examples/cdp_mode/raw_chatgpt.py @@ -17,6 +17,7 @@ with SB(uc=True, test=True, ad_block=True) as sb: 'button[data-testid="stop-button"]', timeout=20 ) chat = sb.find_element('[data-message-author-role="assistant"] .markdown') - soup = sb.get_beautiful_soup(chat.get_html()).get_text("\n").strip() - print("*** Response from ChatGPT: ***\n%s" % soup.replace("\n:", ":")) + soup = sb.get_beautiful_soup(chat.get_html()).text.strip() + soup = soup.replace("\n\n\n", "\n\n") + print("*** Response from ChatGPT: ***\n%s" % soup) sb.sleep(3) diff --git a/examples/cdp_mode/raw_elal.py b/examples/cdp_mode/raw_elal.py index 81fe30cf..e7b99432 100644 --- a/examples/cdp_mode/raw_elal.py +++ b/examples/cdp_mode/raw_elal.py @@ -5,13 +5,13 @@ with SB(uc=True, test=True, locale="en") as sb: sb.activate_cdp_mode(url) sb.sleep(2) sb.cdp.click('button[data-att="search"]') - sb.sleep(4) + sb.sleep(5) sb.cdp.click_if_visible("#onetrust-close-btn-container button") - sb.sleep(0.5) + sb.sleep(1) view_other_dates = 'button[aria-label*="viewOtherDates.cta"]' if sb.cdp.is_element_visible(view_other_dates): sb.cdp.click(view_other_dates) - sb.sleep(4.5) + sb.sleep(5) if sb.is_element_visible("flexible-search-calendar"): print("*** Flight Calendar for El Al (Boston to Tel Aviv): ***") print(sb.cdp.get_text("flexible-search-calendar")) @@ -29,7 +29,7 @@ with SB(uc=True, test=True, locale="en") as sb: sb.cdp.scroll_down(12) sb.sleep(1) sb.cdp.find_element_by_text(lowest_price).click() - sb.sleep(1) + sb.sleep(2) search_cell = 'button[aria-label*="Search.cell.buttonTitle"]' sb.cdp.scroll_into_view(search_cell) sb.sleep(1)