-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!I-defectSomething is not working as intendedSomething is not working as intended
Description
What happened?
BUG?: Python import selenium webdriver error on Python 3.12.4
Description
Import error with selenium.webdriver on Python 3.12.4
Steps to Reproduce
- Python 3.12.4
- selenium 4.28.1
- Import fails:
from selenium import webdriver
### How can we reproduce the issue?
```shell
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from urllib.parse import urlparse
def get_cookies(url):
options = Options()
options.add_argument('--headless')
driver = selenium.webdriver.Chrome(options=options)
driver.get(url)
cookies = driver.get_cookies()
driver.quit()
return {
cookie['name']: cookie['value']
for cookie in cookies
}
url = "https://www.google.com"
cookies = get_cookies(url)
print(cookies)Relevant log output
Traceback (most recent call last):
File "/Users/*/Desktop/CoolEnglishHacker/selenium.py", line 1, in <module>
from selenium import webdriver
File "/Users/*/Desktop/CoolEnglishHacker/selenium.py", line 1, in <module>
from selenium import webdriver
ImportError: cannot import name 'webdriver' from 'selenium' (consider renaming '/Users/*/Desktop/CoolEnglishHacker/selenium.py' if it has the same name as a library you intended to import)Operating System
MacOS 15.1.1
Selenium version
selenium 4.28.1
What are the browser(s) and version(s) where you see this issue?
Chrome 131.0.6778.265
What are the browser driver(s) and version(s) where you see this issue?
no
Are you using Selenium Grid?
selenium 4.28.1
Metadata
Metadata
Assignees
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!I-defectSomething is not working as intendedSomething is not working as intended