-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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]: Failed to set preferences: unknown error
when specify a profile.
#14652
Comments
@heckad, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
The given code is incomplete. |
No, that's really all except two imports (Updated messaged to add them and add python's traceback). |
Hi @heckad, I was able to reproduce this issue on a Windows machine. Interestingly, this isn't a problem on macOS; the script worked fine, and the required profile was launched. |
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
firefox_options = Options()
firefox_options.add_argument(r"--profile D:\\path\\to\\profile\\dir")
driver = webdriver.Firefox(options=firefox_options) EDIT: This won't fix it, please ignore. |
Yer, in row string mode you can write a path without double slashes. |
I have the same problem on my Linux machine and in Docker too. FROM python:3.12
# Install Firefox
ARG FIREFOX_VERSION=131.0
RUN echo "deb http://deb.debian.org/debian/ unstable main contrib non-free" >> /etc/apt/sources.list.d/debian.list
RUN apt-get update -qqy \
&& apt-get -qqy --no-install-recommends install firefox \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
&& wget --no-verbose -O /tmp/firefox.tar.bz2 https://download-installer.cdn.mozilla.net/pub/firefox/releases/$FIREFOX_VERSION/linux-x86_64/en-US/firefox-$FIREFOX_VERSION.tar.bz2 \
&& apt-get -y purge firefox \
&& rm -rf /opt/firefox \
&& tar -C /opt -xjf /tmp/firefox.tar.bz2 \
&& rm /tmp/firefox.tar.bz2 \
&& mv /opt/firefox /opt/firefox-$FIREFOX_VERSION \
&& ln -fs /opt/firefox-$FIREFOX_VERSION/firefox /usr/bin/firefox
RUN pip install selenium
RUN cat <<EOF > main.py
import sys
from pathlib import Path
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.service import Service
path = Path(__file__).parent / "firefox_profile"
firefox_options = Options()
firefox_options.add_argument(f"--profile {path}")
firefox_options.add_argument("--headless")
firefox_options.log.level = "trace"
driver = webdriver.Firefox(options=firefox_options, service=Service(log_output=sys.stdout))
driver.get("https://google.com")
driver.quit()
EOF
CMD ["python", "main.py"] |
What happened?
Expected Behavior -
Firefox run withprovided profile
Actual Behavior -
Firefox is not running
How can we reproduce the issue?
Python's traceback
Relevant log output
Operating System
Windows 11
Selenium version
python 3.12
What are the browser(s) and version(s) where you see this issue?
131.0.3
What are the browser driver(s) and version(s) where you see this issue?
GecoDriver 0.35.0
Are you using Selenium Grid?
No response
The text was updated successfully, but these errors were encountered: