mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #3244] firefox silenium #2037
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#2037
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ddd7et on GitHub (Feb 24, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3244
How to run a program silenium with firejail? I want to run Firefox with silenium inside python program.
Example, python file start.py
``
``
Output: FileNotFoundError: [Errno 2] No such file or directory: 'firejail /usr/bin/geckodriver'
But I have geckodriver in /usr/bin folder.
@rusty-snake commented on GitHub (Feb 24, 2020):
The error says that it can not find "firejail /usr/bin/geckodriver".
@ddd7et commented on GitHub (Feb 24, 2020):
Ok,
driver = webdriver.Firefox("firejail --profile=firefox /usr/bin/geckodriver")Output FileNotFoundError: [Errno 2] No such file or directory: 'firejail --profile=firefox /usr/bin/geckodriver'
I have Firefox Profile and you can see that I add folder /usr/bin folder. Also I added a folder /tmp (this folder is needed to selenium)
EDIT by @rusty-snake: code-block for profile.
@rusty-snake commented on GitHub (Feb 24, 2020):
Referring to https://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.firefox.webdriver the first argument is the firefox profile.
And
/usr/binis never blacklisted in the profile provided by firejail.@rusty-snake commented on GitHub (Feb 24, 2020):
Because of you firefox.profile I assume that you have an firejail-version older than 0.9.60, there you can't use
firejail --profile=firefox.This is not a shell-command! It tries to open/create the file/directory
firejail --profile=firefox /usr/bin/geckodriverand not to execute this.@rusty-snake commented on GitHub (Feb 24, 2020):
Maybe you need something like this:
https://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.firefox.firefox_binary
https://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.firefox.webdriver
@ddd7et commented on GitHub (Feb 24, 2020):
start_browser.py file
``
``
Traceback (most recent call last):
File "/home/mn/AKernel/Program/start_browser.py", line 32, in
driver = webdriver.Firefox(firefox_binary=firefox_binary)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/firefox/webdriver.py", line 174, in init
keep_alive=True)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in init
self.start_session(capabilities, browser_profile)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities
Process returned 1 (0x1) execution time : 1.343 s
@ddd7et commented on GitHub (Feb 24, 2020):
geckodriver.log: Error: invalid -version command line option
@ddd7et commented on GitHub (Feb 25, 2020):
This is answer from Henrik Skupin
Note that firejail needs an argument when being called (firejail firefox), and I don't see how this would work with your code above, which doesn't adds that. What you would need is a wrapper script for Firefox which includes that command, and can be called via geckodriver.
@matu3ba commented on GitHub (Feb 27, 2020):
@ddd7et Could be unrelated to firejail here or this.
This might help you tracking exactly what fails.
I would suggest you to step-wise comment in all capability drops (in the loaded profile file) to obtain the thing that does not work.
Does the program work without firejail?
@ghost commented on GitHub (Feb 27, 2020):
I think there might be some confusion here around the term
capabilities. The above error refers to WebDriver capabilities (see here) and not to firejail's (Linux kernel) capabilities.@rusty-snake commented on GitHub (Mar 14, 2020):
@ddd7et still need help?
@ddd7et commented on GitHub (Mar 15, 2020):
Yes and no. Yes, because I did not solve problem. No, because I use silenium (firefox) without firejail, and this is normal. I can live without firejail. I use firefox with silenium as the main browser for myself, and I will do this until August 2020. In August 2020, I want to return to this topic and I will try to think about it again.
@ddd7et commented on GitHub (Mar 16, 2020):
Yes, the program works without firejail. Firefox with selenium webdriver is my main browser. I'm writing this post with firefox selenium without firejail.
@ghost commented on GitHub (Mar 16, 2020):
@ddd7et Can you post your firefox selenium python script here please. I happen to use geckodriver/curl to open URL's intercepted from other sandboxed applications in an already running, fully firejailed Firefox. IMHO that's easier than starting Firefox via the WebDriver protocol and have it firejailed at the same time. That being said, if I look at code examples in this thread, I don't see any webdriver capabilities being passed. What about something like:
But without showing us your script this is all just guess-work...
@ddd7et commented on GitHub (Mar 16, 2020):
Thank your for your interest to this topic.
This is my script (You can see how I run my Firefox but my full program is much harder, it's a very simple example). So this is file Start_Firefox.py
And this works and I can run my Firefox without Firejail. I use this script to run my Firefox silenium as my main (default) browser. I don't use ordinary firefox without silenium.
My script (How I run this py file) (file run.sh)
If I run your script:
I have the error:
Traceback (most recent call last):
File "/home/mn/Program//test.py", line 9, in
desired_capabilities=DesiredCapabilities.FIREFOX)
File "/home/mn/.virtualenvs/cat/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in init
keep_alive=True)
File "/home/mn/.virtualenvs/cat/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in init
self.start_session(capabilities, browser_profile)
File "/home/mn/.virtualenvs/cat/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/home/mn/.virtualenvs/cat/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/home/mn/.virtualenvs/cat/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities
@ghost commented on GitHub (Mar 16, 2020):
Hm, that makes sense now I look at it again:
The selenium webdriver tries to obtain the needed capabilities from the firejail binary, which will never succeed obviously. My knowledge of selenium is very limited, as I said, I only use geckodriver to connect to a running Firefox instance- which is already firejailed - and open a URL. That's quite easy in comparison. I'll try putting together a wrapper script and report back here, but to be honest I don't see how to pass this capabilities hurdle.
@rusty-snake commented on GitHub (May 6, 2020):
I'm closing here due to inactivity, please fell free to reopen if you have more questions.