@@ -1310,14 +1310,12 @@ def get_title(self):
13101310 return self.get_page_title()
13111311
13121312 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;")
13151314
13161315 def get_locale_code(self):
1317- locale_code = self.execute_script(
1316+ return self.execute_script(
13181317 "return navigator.language || navigator.languages[0];"
13191318 )
1320- return locale_code
13211319
13221320 def go_back(self):
13231321 self.__check_scope()
@@ -2161,10 +2159,9 @@ def find_visible_elements(self, selector, by="css selector", limit=0):
21612159 selector, by = self.__recalculate_selector(selector, by)
21622160 self.wait_for_ready_state_complete()
21632161 time.sleep(0.05)
2164- v_elems = page_actions.find_visible_elements(
2162+ return page_actions.find_visible_elements(
21652163 self.driver, selector, by, limit
21662164 )
2167- return v_elems
21682165
21692166 def click_visible_elements(
21702167 self, selector, by="css selector", limit=0, timeout=None
@@ -6450,8 +6447,7 @@ def get_beautiful_soup(self, source=None):
64506447 except Exception:
64516448 pass
64526449 source = self.get_page_source()
6453- soup = BeautifulSoup(source, "html.parser")
6454- return soup
6450+ return BeautifulSoup(source, "html.parser")
64556451
64566452 def get_unique_links(self):
64576453 """Get all unique links in the html of the page source.
@@ -6473,8 +6469,7 @@ def get_unique_links(self):
64736469 time.sleep(0.123)
64746470 soup = self.get_beautiful_soup(self.get_page_source())
64756471 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)
64786473
64796474 def get_link_status_code(
64806475 self,
@@ -6493,13 +6488,12 @@ def get_link_status_code(
64936488 timeout = self.__requests_timeout
64946489 if timeout < 1:
64956490 timeout = 1
6496- status_code = page_utils._get_link_status_code(
6491+ return page_utils._get_link_status_code(
64976492 link,
64986493 allow_redirects=allow_redirects,
64996494 timeout=timeout,
65006495 verify=verify,
65016496 )
6502- return status_code
65036497
65046498 def assert_link_status_code_is_not_404(self, link):
65056499 status_code = str(self.get_link_status_code(link))
@@ -6735,8 +6729,7 @@ def get_pdf_text(
67356729 pdf_text = self.__fix_unicode_conversion(pdf_text)
67366730 if wrap:
67376731 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()
67406733
67416734 def assert_pdf_text(
67426735 self,
@@ -7741,8 +7734,7 @@ def is_valid_url(self, url):
77417734
77427735 def is_online(self):
77437736 """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;")
77467738
77477739 def is_chromium(self):
77487740 """Return True if the browser is Chrome or Edge."""
@@ -13210,8 +13202,7 @@ def __jquery_click(self, selector, by="css selector"):
1321013202
1321113203 def __get_major_browser_version(self):
1321213204 version = self.driver.__dict__["caps"]["browserVersion"]
13213- major_browser_version = version.split(".")[0]
13214- return major_browser_version
13205+ return version.split(".")[0]
1321513206
1321613207 def __get_href_from_link_text(self, link_text, hard_fail=True):
1321713208 href = self.get_link_attribute(link_text, "href", hard_fail)
0 commit comments