-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Description
What happened?
Hi, i am currently trying to run a python script that navigate on the web with selenium and get the html of the product page on a web site and then do scraping to collect info. The info are stored in a database mariadb.
I am on a Rasberry pi 5 on Ubuntu, the version of Chromium is Chromium 133.0.6943.141 snap and the version of the chromedriver is ChromeDriver 133.0.6943.141 (2a5d6da0d6165d7b107502095a937fe7704fcef6-refs/branch-heads/6943@{#1912}). As the title said i can't run the script without getting the error:
Message: session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
Stacktrace:
#0 0xaaaadab81694 <unknown>
#1 0xaaaada6b58a4 <unknown>
#2 0xaaaada6e89c8 <unknown>
#3 0xaaaada6e51a4 <unknown>
#4 0xaaaada72a0b8 <unknown>
#5 0xaaaada729944 <unknown>
#6 0xaaaada6f0b84 <unknown>
#7 0xaaaadab4fd28 <unknown>
#8 0xaaaadab531d8 <unknown>
#9 0xaaaadab3f5e4 <unknown>
#10 0xaaaadab53854 <unknown>
#11 0xaaaadab276d0 <unknown>
#12 0xaaaadab70980 <unknown>
#13 0xaaaadab70b50 <unknown>
#14 0xaaaadab8048c <unknown>
#15 0xffffa7fad5c4 <unknown>
#16 0xffffa8015ed8 <unknown>
Traceback (most recent call last):
File "/home/realtalker/data_workers/scraping_best/get_info_best.py", line 402, in <module>
driver.quit()
^^^^^^
NameError: name 'driver' is not defined. Did you mean: 'webdriver'?
My chrome options are:
options = Options()
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--headless=new')
options.add_argument('--disable-gpu')
options.add_argument('--disable-extensions')
options.add_argument('--remote-debugging-port=9222') # Specify a port
options.add_argument('--disable-setuid-sandbox')
options.add_argument("--incognito")
options.add_argument("--disable-application-cache")
options.add_argument("--enable-do-not-track")
options.add_argument("--disable-popup-blocking")
options.binary_location = '/snap/bin/chromium'
service = Service('/usr/bin/chromedriver')
I saw in a github report that maybe there is a problem when running as root, i checked and i am not running as root, i tried to run the chromedriver and:
(.venv) realtalker@ubuntu:~/data_workers/scraping_best$ chromedriver
Starting ChromeDriver 133.0.6943.141 (2a5d6da0d6165d7b107502095a937fe7704fcef6-refs/branch-heads/6943@{#1912}) on port 0
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully on port 42027.
so i checked with ps -aux | grep chromedriver and i got:
realtal+ 167950 4.1 0.1 33614684 13824 pts/2 Sl+ 16:46 0:00 /snap/chromium/3053/usr/lib/chromium-browser/chromedriver
realtal+ 168021 0.0 0.0 6676 1920 pts/1 S+ 16:46 0:00 grep --color=auto chromedriver
then i tried to run the same command to check with chromium before i could get the error and:
realtal+ 168029 14.4 0.1 33622940 14720 pts/2 Sl+ 16:48 0:00 /snap/chromium/3053/usr/lib/chromium-browser/chromedriver --port=60075
realtal+ 168103 0.0 0.0 6676 1920 pts/1 S+ 16:48 0:00 grep --color=auto chromium
I lost hope.
ps: i have a pastebin with the code: https://pastebin.com/aL4QiGV4 (dont read the message README because is from another error with cron)
How can we reproduce the issue?
---Relevant log output
Message: session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
Stacktrace:
#0 0xaaaaba161694 <unknown>
#1 0xaaaab9c958a4 <unknown>
#2 0xaaaab9cc89c8 <unknown>
#3 0xaaaab9cc51a4 <unknown>
#4 0xaaaab9d0a0b8 <unknown>
#5 0xaaaab9d09944 <unknown>
#6 0xaaaab9cd0b84 <unknown>
#7 0xaaaaba12fd28 <unknown>
#8 0xaaaaba1331d8 <unknown>
#9 0xaaaaba11f5e4 <unknown>
#10 0xaaaaba133854 <unknown>
#11 0xaaaaba1076d0 <unknown>
#12 0xaaaaba150980 <unknown>
#13 0xaaaaba150b50 <unknown>
#14 0xaaaaba16048c <unknown>
#15 0xffff8317d5c4 <unknown>
#16 0xffff831e5ed8 <unknown>
Traceback (most recent call last):
File "/home/realtalker/data_workers/scraping_best/get_info_best.py", line 397, in <module>
driver.quit()
^^^^^^
NameError: name 'driver' is not defined. Did you mean: 'webdriver'?Operating System
Linux ubuntu 6.8.0-1018-raspi #20-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 17 12:35:36 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux
Selenium version
selenium==4.28.1
What are the browser(s) and version(s) where you see this issue?
Chromium 133.0.6943.141 snap
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 133.0.6943.141 (2a5d6da0d6165d7b107502095a937fe7704fcef6-refs/branch-heads/6943@{#1912})
Are you using Selenium Grid?
No response