Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the JS checker #3597

Merged
merged 3 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions examples/cdp_mode/raw_chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
'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)
8 changes: 4 additions & 4 deletions examples/cdp_mode/raw_elal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
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"))
Expand All @@ -29,7 +29,7 @@
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)
Expand Down
2 changes: 1 addition & 1 deletion seleniumbase/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "4.35.5"
__version__ = "4.35.6"
29 changes: 24 additions & 5 deletions seleniumbase/fixtures/base_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -8070,10 +8070,6 @@ def assert_no_js_errors(self, exclude=[]):
else:
found = False
message = entry["message"]
if message.count(" - Failed to load resource") == 1:
message = message.split(
" - Failed to load resource"
)[0]
for substring in exclude:
substring = str(substring)
if (
Expand All @@ -8091,7 +8087,30 @@ def assert_no_js_errors(self, exclude=[]):
u_c_t_e = " Uncaught TypeError: "
if f_t_l_r in errors[n]["message"]:
url = errors[n]["message"].split(f_t_l_r)[0]
errors[n] = {"Error 404 (broken link)": url}
if "status of 400" in errors[n]["message"]:
errors[n] = {"Error 400 (Bad Request)": url}
elif "status of 401" in errors[n]["message"]:
errors[n] = {"Error 401 (Unauthorized)": url}
elif "status of 402" in errors[n]["message"]:
errors[n] = {"Error 402 (Payment Required)": url}
elif "status of 403" in errors[n]["message"]:
errors[n] = {"Error 403 (Forbidden)": url}
elif "status of 404" in errors[n]["message"]:
errors[n] = {"Error 404 (Not Found)": url}
elif "status of 405" in errors[n]["message"]:
errors[n] = {"Error 405 (Method Not Allowed)": url}
elif "status of 406" in errors[n]["message"]:
errors[n] = {"Error 406 (Not Acceptable)": url}
elif "status of 407" in errors[n]["message"]:
errors[n] = {"Error 407 (Proxy Auth Required)": url}
elif "status of 408" in errors[n]["message"]:
errors[n] = {"Error 408 (Request Timeout)": url}
elif "status of 409" in errors[n]["message"]:
errors[n] = {"Error 409 (Conflict)": url}
elif "status of 410" in errors[n]["message"]:
errors[n] = {"Error 410 (Gone)": url}
else:
errors[n] = {"Failed to load resource": url}
elif u_c_s_e in errors[n]["message"]:
url = errors[n]["message"].split(u_c_s_e)[0]
error = errors[n]["message"].split(u_c_s_e)[1]
Expand Down