@@ -1310,14 +1310,12 @@ def get_title(self):
1310
1310
return self.get_page_title()
1311
1311
1312
1312
def get_user_agent(self):
1313
- user_agent = self.execute_script("return navigator.userAgent;")
1314
- return user_agent
1313
+ return self.execute_script("return navigator.userAgent;")
1315
1314
1316
1315
def get_locale_code(self):
1317
- locale_code = self.execute_script(
1316
+ return self.execute_script(
1318
1317
"return navigator.language || navigator.languages[0];"
1319
1318
)
1320
- return locale_code
1321
1319
1322
1320
def go_back(self):
1323
1321
self.__check_scope()
@@ -2161,10 +2159,9 @@ def find_visible_elements(self, selector, by="css selector", limit=0):
2161
2159
selector, by = self.__recalculate_selector(selector, by)
2162
2160
self.wait_for_ready_state_complete()
2163
2161
time.sleep(0.05)
2164
- v_elems = page_actions.find_visible_elements(
2162
+ return page_actions.find_visible_elements(
2165
2163
self.driver, selector, by, limit
2166
2164
)
2167
- return v_elems
2168
2165
2169
2166
def click_visible_elements(
2170
2167
self, selector, by="css selector", limit=0, timeout=None
@@ -6450,8 +6447,7 @@ def get_beautiful_soup(self, source=None):
6450
6447
except Exception:
6451
6448
pass
6452
6449
source = self.get_page_source()
6453
- soup = BeautifulSoup(source, "html.parser")
6454
- return soup
6450
+ return BeautifulSoup(source, "html.parser")
6455
6451
6456
6452
def get_unique_links(self):
6457
6453
"""Get all unique links in the html of the page source.
@@ -6473,8 +6469,7 @@ def get_unique_links(self):
6473
6469
time.sleep(0.123)
6474
6470
soup = self.get_beautiful_soup(self.get_page_source())
6475
6471
page_url = self.get_current_url()
6476
- links = page_utils._get_unique_links(page_url, soup)
6477
- return links
6472
+ return page_utils._get_unique_links(page_url, soup)
6478
6473
6479
6474
def get_link_status_code(
6480
6475
self,
@@ -6493,13 +6488,12 @@ def get_link_status_code(
6493
6488
timeout = self.__requests_timeout
6494
6489
if timeout < 1:
6495
6490
timeout = 1
6496
- status_code = page_utils._get_link_status_code(
6491
+ return page_utils._get_link_status_code(
6497
6492
link,
6498
6493
allow_redirects=allow_redirects,
6499
6494
timeout=timeout,
6500
6495
verify=verify,
6501
6496
)
6502
- return status_code
6503
6497
6504
6498
def assert_link_status_code_is_not_404(self, link):
6505
6499
status_code = str(self.get_link_status_code(link))
@@ -6735,8 +6729,7 @@ def get_pdf_text(
6735
6729
pdf_text = self.__fix_unicode_conversion(pdf_text)
6736
6730
if wrap:
6737
6731
pdf_text = pdf_text.replace(" \n", " ")
6738
- pdf_text = pdf_text.strip() # Remove leading and trailing whitespace
6739
- return pdf_text
6732
+ return pdf_text.strip()
6740
6733
6741
6734
def assert_pdf_text(
6742
6735
self,
@@ -7741,8 +7734,7 @@ def is_valid_url(self, url):
7741
7734
7742
7735
def is_online(self):
7743
7736
"""Return True if connected to the Internet."""
7744
- online = self.execute_script("return navigator.onLine;")
7745
- return online
7737
+ return self.execute_script("return navigator.onLine;")
7746
7738
7747
7739
def is_chromium(self):
7748
7740
"""Return True if the browser is Chrome or Edge."""
@@ -13210,8 +13202,7 @@ def __jquery_click(self, selector, by="css selector"):
13210
13202
13211
13203
def __get_major_browser_version(self):
13212
13204
version = self.driver.__dict__["caps"]["browserVersion"]
13213
- major_browser_version = version.split(".")[0]
13214
- return major_browser_version
13205
+ return version.split(".")[0]
13215
13206
13216
13207
def __get_href_from_link_text(self, link_text, hard_fail=True):
13217
13208
href = self.get_link_attribute(link_text, "href", hard_fail)
0 commit comments