Skip to content

Commit 9d76cc9

Browse files
committed
Fix assert_no_404_errors() method
1 parent 279f0d4 commit 9d76cc9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1690,7 +1690,8 @@ def assert_no_404_errors(self, multithreaded=True):
16901690
pool.join()
16911691
else:
16921692
for link in links:
1693-
self.assert_link_status_code_is_not_404(link)
1693+
if "javascript:" not in link: # Ignore links with JavaScript
1694+
self.assert_link_status_code_is_not_404(link)
16941695
if self.demo_mode:
16951696
messenger_post = ("ASSERT NO 404 ERRORS")
16961697
js_utils.post_messenger_success_message(

seleniumbase/fixtures/page_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def get_domain_url(url):
1313
Into this:
1414
https://blog.xkcd.com
1515
"""
16-
if "http://" not in url and "https://" not in url:
16+
if not url.startswith("http://") and not url.startswith("https://"):
1717
return url
1818
url_header = url.split('://')[0]
1919
simple_url = url.split('://')[1]
@@ -118,7 +118,8 @@ def _get_unique_links(page_url, soup):
118118
Includes:
119119
"a"->"href", "img"->"src", "link"->"href", and "script"->"src" links.
120120
"""
121-
if "http://" not in page_url and "https://" not in page_url:
121+
if not page_url.startswith("http://") and (
122+
not page_url.startswith("https://")):
122123
return []
123124
prefix = 'http:'
124125
if page_url.startswith('https:'):

0 commit comments

Comments
 (0)