Update examples

This commit is contained in:
Michael Mintz 2025-03-07 11:02:08 -05:00
parent f30187da55
commit 1b02e839e7
2 changed files with 7 additions and 6 deletions

View File

@ -17,6 +17,7 @@ with SB(uc=True, test=True, ad_block=True) as sb:
'button[data-testid="stop-button"]', timeout=20 'button[data-testid="stop-button"]', timeout=20
) )
chat = sb.find_element('[data-message-author-role="assistant"] .markdown') chat = sb.find_element('[data-message-author-role="assistant"] .markdown')
soup = sb.get_beautiful_soup(chat.get_html()).get_text("\n").strip() soup = sb.get_beautiful_soup(chat.get_html()).text.strip()
print("*** Response from ChatGPT: ***\n%s" % soup.replace("\n:", ":")) soup = soup.replace("\n\n\n", "\n\n")
print("*** Response from ChatGPT: ***\n%s" % soup)
sb.sleep(3) sb.sleep(3)

View File

@ -5,13 +5,13 @@ with SB(uc=True, test=True, locale="en") as sb:
sb.activate_cdp_mode(url) sb.activate_cdp_mode(url)
sb.sleep(2) sb.sleep(2)
sb.cdp.click('button[data-att="search"]') sb.cdp.click('button[data-att="search"]')
sb.sleep(4) sb.sleep(5)
sb.cdp.click_if_visible("#onetrust-close-btn-container button") 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"]' view_other_dates = 'button[aria-label*="viewOtherDates.cta"]'
if sb.cdp.is_element_visible(view_other_dates): if sb.cdp.is_element_visible(view_other_dates):
sb.cdp.click(view_other_dates) sb.cdp.click(view_other_dates)
sb.sleep(4.5) sb.sleep(5)
if sb.is_element_visible("flexible-search-calendar"): if sb.is_element_visible("flexible-search-calendar"):
print("*** Flight Calendar for El Al (Boston to Tel Aviv): ***") print("*** Flight Calendar for El Al (Boston to Tel Aviv): ***")
print(sb.cdp.get_text("flexible-search-calendar")) 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.cdp.scroll_down(12)
sb.sleep(1) sb.sleep(1)
sb.cdp.find_element_by_text(lowest_price).click() sb.cdp.find_element_by_text(lowest_price).click()
sb.sleep(1) sb.sleep(2)
search_cell = 'button[aria-label*="Search.cell.buttonTitle"]' search_cell = 'button[aria-label*="Search.cell.buttonTitle"]'
sb.cdp.scroll_into_view(search_cell) sb.cdp.scroll_into_view(search_cell)
sb.sleep(1) sb.sleep(1)