thelabcat / rumble-chat-actor

Interact with the chat of your livestreams in Python
GNU General Public License v3.0
2 stars 0 forks source link

Cannot start with Snap edition of Firefox #21

Open BarryBahrami opened 1 month ago

BarryBahrami commented 1 month ago

Nice library. I'm having difficulty getting it to run though. can you give me some info about the basic setup?

I have ubuntu 24.04 and it wants to install firefox with snap. I'm not sure your library is seeing it. little lost.

thank you

thelabcat commented 1 month ago

I'll have to look into how to use Selenium WebDriver with Snap Firefox rather than a system package, but what error are you getting exactly?

thelabcat commented 1 month ago

Looking into this via a virtual machine, the problem seems to tie back to Snap. It is a real known limitation of Geckodriver, but the sandbox workarounds listed here did not work for me. As a test, I used independent Firefox and Geckodriver executables in Selenium (not RumChat Actor) via the following code...

from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.service import Service
fpath = "/home/wilbur/Downloads/firefox-129.0.1/firefox/firefox"
gpath = "/home/wilbur/Downloads/geckodriver"
driver_service = Service(executable_path = gpath)
options = Options()
options.binary_location = fpath
driver = webdriver.Firefox(options = options, service = driver_service)

...and the driver does open successfully. Since Firefox has an official ppa available, I recommend you use the first workaround they mention: A non-sandboxed Firefox install. To do this, migrate your Firefox profile with mkdir -p ~/.mozilla/firefox/ && cp -a ~/snap/firefox/common/.mozilla/firefox/* ~/.mozilla/firefox/ (or sync with a Mozilla account), uninstall the Firefox Snap edition with snap remove firefox, and install the non-Snap version per Mozilla's instructions. I have confirmed that this will make Selenium WebDriver work normally. If you can figure out how to make Snap Firefox work properly, possibly in the future when the included Snap Geckodriver is up to date, let me know.

BarryBahrami commented 4 weeks ago

Your firefox install workaround worked for me - thank you.

Ideally I need to run this headless. Do you think that will ever be an option?

I ended up having to fix a couple things mostly with f-strings for the library to run, for me at least. I can email these to you if you like or tell me if/how you want them. thank you

thelabcat commented 4 weeks ago

Ideally I need to run this headless. Do you think that will ever be an option?

See #20

I ended up having to fix a couple things mostly with f-strings for the library to run, for me at least. I can email these to you if you like or tell me if/how you want them. thank you

I just made an update that fixes a few problems, but if you update and they are still there, the standard way is to:

  1. File an issue detailing the problem (you can stop here and let the main developers [me in this case] fix the issue, or keep going)
  2. Fork the repository
  3. Make the needed changes in your fork
  4. File the fork as a pull request, referencing the open issue