Skip to content

Commit 29a2df5

Browse files
committed
Add new method: "is_online()"
1 parent e35fbd5 commit 29a2df5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

help_docs/method_summary.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,8 @@ self.inspect_html()
502502

503503
self.is_valid_url(url)
504504

505+
self.is_online()
506+
505507
self.is_chromium()
506508

507509
self.get_chrome_version()

seleniumbase/fixtures/base_case.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7271,6 +7271,11 @@ def is_valid_url(self, url):
72717271
"""Return True if the url is a valid url."""
72727272
return page_utils.is_valid_url(url)
72737273

7274+
def is_online(self):
7275+
"""Return True if connected to the Internet."""
7276+
online = self.execute_script("return navigator.onLine;")
7277+
return online
7278+
72747279
def is_chromium(self):
72757280
"""Return True if the browser is Chrome, Edge, or Opera."""
72767281
self.__check_scope()

0 commit comments

Comments
 (0)