Skip to content

Commit 1503d75

Browse files
authored
Merge pull request #834 from seleniumbase/fix-method-that-finds-unique-links
Fix a method that finds unique links
2 parents 87357f2 + 95f6710 commit 1503d75

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

examples/swag_labs_suite.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55

66
class SwagLabsTests(BaseCase):
77

8-
def login_to_swag_labs(self, username="standard_user"):
8+
def login_to_swag_labs(self, username="standard_user", v1=False):
99
""" Login to Swag Labs and verify success. """
10-
self.open("https://www.saucedemo.com/")
10+
url = "https://www.saucedemo.com"
11+
if v1:
12+
url += "/v1"
13+
self.open(url)
1114
if username not in self.get_text("#login_credentials"):
1215
self.fail("Invalid user for login: %s" % username)
1316
self.type("#user-name", username)
@@ -86,12 +89,8 @@ def test_swag_labs_basic_flow(self, username):
8689
@pytest.mark.run(order=2)
8790
def test_swag_labs_products_page_links(self, username):
8891
""" This test checks for 404s on the Swag Labs products page.
89-
This test is parameterized on the login user.
90-
Swag Labs replaced broken links with dog images for the
91-
"problem_user" login, so the test switches those back
92-
to demonstrate the "assert_no_404_errors()" method. """
93-
self.login_to_swag_labs(username=username)
94-
self.set_attributes('img[src*="/sl-404"]', "src", "/bad_link.jpg")
92+
This test is parameterized on the login user. """
93+
self.login_to_swag_labs(username=username, v1=True)
9594
self.assert_no_404_errors()
9695

9796
@parameterized.expand([

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ packaging>=20.9
44
setuptools>=44.1.1;python_version<"3.5"
55
setuptools>=50.3.2;python_version>="3.5" and python_version<"3.6"
66
setuptools>=54.0.0;python_version>="3.6"
7-
setuptools-scm>=5.0.1
7+
setuptools-scm>=5.0.2
88
wheel>=0.36.2
99
attrs>=20.3.0
1010
PyYAML>=5.4.1;python_version>="3.6"

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "1.56.6"
2+
__version__ = "1.56.7"

seleniumbase/fixtures/page_utils.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,17 @@ def _get_unique_links(page_url, soup):
166166
elif link.startswith('/'):
167167
link = full_base_url + link
168168
elif link.startswith('./'):
169-
link = full_base_url + link[1:]
169+
f_b_url = full_base_url
170+
if len(simple_url.split('/')) > 1:
171+
f_b_url = full_base_url + "/" + simple_url.split('/')[1]
172+
link = f_b_url + link[1:]
170173
elif link.startswith('#'):
171174
link = full_base_url + link
172175
elif '//' not in link:
173-
link = full_base_url + "/" + link
176+
f_b_url = full_base_url
177+
if len(simple_url.split('/')) > 1:
178+
f_b_url = full_base_url + "/" + simple_url.split('/')[1]
179+
link = f_b_url + "/" + link
174180
else:
175181
pass
176182
unique_links.append(link)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
'setuptools>=44.1.1;python_version<"3.5"',
109109
'setuptools>=50.3.2;python_version>="3.5" and python_version<"3.6"',
110110
'setuptools>=54.0.0;python_version>="3.6"',
111-
'setuptools-scm>=5.0.1',
111+
'setuptools-scm>=5.0.2',
112112
'wheel>=0.36.2',
113113
'attrs>=20.3.0',
114114
'PyYAML>=5.4.1;python_version>="3.6"',

0 commit comments

Comments
 (0)