Skip to content

A few small updates #2290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion examples/hack_the_planet.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ def test_all_your_base_are_belong_to_us(self):
self.open("https://dev.to/top/infinity")
self.click_if_visible('button[aria-label="Close campaign banner"]')
self.click_if_visible('svg[aria-label="Close campaign banner"]')
self.hide_elements('main div:contains("Pinned")')
try:
self.hide_elements('main div:contains("Pinned")')
except Exception:
pass
self.set_text_content('nav a[data-text="Relevant"]', "ALL")
self.set_text_content('nav a[data-text="Latest"]', "YOUR")
self.set_text_content('nav a[data-text="Top"]', "BASE")
Expand Down
10 changes: 6 additions & 4 deletions examples/raw_uc_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
from seleniumbase import SB

with SB(uc=True) as sb:
sb.driver.get("https://nowsecure.nl/#relax")
sb.sleep(1)
sb.driver.uc_open_with_tab("https://nowsecure.nl/#relax")
sb.sleep(1.2)
if not sb.is_text_visible("OH YEAH, you passed!", "h1"):
sb.get_new_driver(undetectable=True)
sb.driver.get("https://nowsecure.nl/#relax")
sb.sleep(1)
sb.driver.uc_open_with_reconnect(
"https://nowsecure.nl/#relax", reconnect_time=3
)
sb.sleep(1.2)
if not sb.is_text_visible("OH YEAH, you passed!", "h1"):
if sb.is_element_visible('iframe[src*="challenge"]'):
with sb.frame_switch('iframe[src*="challenge"]'):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pyotp==2.9.0
markdown-it-py==2.2.0;python_version<"3.8"
markdown-it-py==3.0.0;python_version>="3.8"
mdurl==0.1.2
rich==13.6.0
rich==13.7.0

# --- Testing Requirements --- #
# ("pip install -r requirements.txt" also installs this, but "pip install -e ." won't.)
Expand Down
2 changes: 1 addition & 1 deletion seleniumbase/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "4.21.2"
__version__ = "4.21.3"
8 changes: 6 additions & 2 deletions seleniumbase/fixtures/base_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -7749,8 +7749,10 @@ def get_chrome_version(self):
driver_capabilities = self.driver.capabilities
if "version" in driver_capabilities:
chrome_version = driver_capabilities["version"]
else:
elif "browserVersion" in driver_capabilities:
chrome_version = driver_capabilities["browserVersion"]
else:
chrome_version = "(Unknown Version)"
return chrome_version

def get_chromium_version(self):
Expand Down Expand Up @@ -15563,8 +15565,10 @@ def _get_browser_version(self):
return "(Unknown Version)"
if "version" in driver_capabilities:
browser_version = driver_capabilities["version"]
else:
elif "browserVersion" in driver_capabilities:
browser_version = driver_capabilities["browserVersion"]
else:
browser_version = "(Unknown Version)"
return browser_version

def _get_driver_name_and_version(self):
Expand Down
6 changes: 4 additions & 2 deletions seleniumbase/undetected/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,10 @@ def quit(self):
try:
logger.debug("Terminating the UC browser")
os.kill(self.browser_pid, 15)
# Not sure if this is really needed:
os.waitpid(self.browser_pid, 0)
if IS_POSIX:
os.waitpid(self.browser_pid, 0)
else:
time.sleep(0.05)
except (AttributeError, ChildProcessError, RuntimeError, OSError):
pass
except TimeoutError as e:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
'markdown-it-py==2.2.0;python_version<"3.8"',
'markdown-it-py==3.0.0;python_version>="3.8"',
'mdurl==0.1.2',
'rich==13.6.0',
'rich==13.7.0',
],
extras_require={
# pip install -e .[allure]
Expand Down