Skip to content
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

[🐛 Bug]: ensure python uses SE_MANAGER_PATH as a pathlib.Path #12929

Closed
bollwyvl opened this issue Oct 11, 2023 · 7 comments
Closed

[🐛 Bug]: ensure python uses SE_MANAGER_PATH as a pathlib.Path #12929

bollwyvl opened this issue Oct 11, 2023 · 7 comments

Comments

@bollwyvl
Copy link

bollwyvl commented Oct 11, 2023

What happened?

When SE_MANAGER_PATH is set, the python implementation uses it directly as a str rather than a Path, but then tries to use Path.is_file.

How can we reproduce the issue?

import os
os.environ["SE_MANAGER_PATH"] = "some/actual/path/to/an/existing/selenium-manager"
from selenium.webdriver.common.selenium_manager import SeleniumManager
assert SeleniumManager.get_binary().exists()

Relevant log output

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File ".../lib/python3.12/site-packages/selenium/webdriver/common/selenium_manager.py", line 60, in get_binary
    if not path.is_file() and os.environ["CONDA_PREFIX"]:
           ^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'is_file'

Operating System

CentOS7

Selenium version

4.14.0

What are the browser(s) and version(s) where you see this issue?

What are the browser driver(s) and version(s) where you see this issue?

Are you using Selenium Grid?

@github-actions
Copy link

@bollwyvl, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@symonk symonk closed this as completed in d9f0010 Oct 11, 2023
@symonk
Copy link
Member

symonk commented Oct 11, 2023

Thanks!

@bollwyvl
Copy link
Author

bollwyvl commented Nov 2, 2023

I think the patch in e15fed5 was missing some parens: sorry I didn't catch it initially, I don't have a lot of walrus experience. We shipped this on conda-forge/selenium-feedstock#69

--- a/selenium/webdriver/common/selenium_manager.py
+++ b/selenium/webdriver/common/selenium_manager.py
@@ -41,7 +41,7 @@ class SeleniumManager:
         :Returns: The Selenium Manager executable location
         """
 
-        if path := os.getenv("SE_MANAGER_PATH") is not None:
+        if (path := os.getenv("SE_MANAGER_PATH")) is not None:
             return Path(path)
         else:
             platform = sys.platform

@titusfortner
Copy link
Member

@symonk / @isaulv / @AutomatedTester can someone verify the logic above? I can get a patch release out if what we have isn't correct.

@isaulv
Copy link
Contributor

isaulv commented Nov 2, 2023

@titusfortner verified that you need parentheses. Without it, path becomes True.

@titusfortner
Copy link
Member

fixed, releasing 4.15.1

Copy link

github-actions bot commented Dec 2, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants