Issue
I am trying to get Selenium working on a Ubuntu VM. I'm having a heck of a time doing it to. No matter what I do, I always get the following dialogue:
I do not need to use any profile in particular. I thought initially that Selenium\Gecko creates a temp profile for it's instance. Below are all the things I've tried. Further, I've also tried running as sudo, and\or setting ownership of the profile to nobody
as well as setting the permissions to the profile directory to 777
. None of which proved fruitful. I have seen other SO posts regarding this, none of which have provided me with anything leading to an answer which is obviously why I am here.
# create a new Firefox session
# binary = FirefoxBinary('/snap/bin/firefox')
# binary = FirefoxBinary('/usr/local/bin/geckodriver')
profile = webdriver.FirefoxProfile(profile_directory='/home/jaberwocky/snap/firefox/common/.mozilla/firefox/tm4nraze.selenium')
# profile.set_preference("browser.download.folderList",2)
# profile.set_preference("browser.download.manager.showWhenStarting",False)
# profile.set_preference("browser.download.dir", os.getcwd())
# profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/octet-stream")
driver = webdriver.Firefox(firefox_profile=profile)
driver.implicitly_wait(20)
driver.get(base_url)
python_button = driver.find_element_by_class_name('sh-hide')
python_button.click()
Selenium Version 3.141.0
Firefox Version 65.0.2
Python Version 3.7.2
Linux Distribution Ubuntu Budgie 18.04.2 LTS
There really isn't a lot of information out there on this problem. What am I doing wrong here?
Update: I found a log file for each execution of gecko. Here is what it shows:
ERROR: ld.so: object '/lib/$LIB/liblsp.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/lib/$LIB/liblsp.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
/snap/firefox/185/bin/desktop-launch: line 174: /home/addohm/snap/firefox/common/.config/user-dirs.dirs: No such file or directory
ERROR: ld.so: object '/lib/$LIB/liblsp.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
cp: cannot create regular file '/home/addohm/snap/firefox/common/.config/': Not a directory
/snap/firefox/185/bin/desktop-launch: line 177: /home/addohm/snap/firefox/common/.config/user-dirs.dirs.md5sum: No such file or directory
/snap/firefox/185/bin/desktop-launch: line 177: /home/addohm/snap/firefox/common/.config/user-dirs.locale.md5sum: No such file or directory
ERROR: ld.so: object '/lib/$LIB/liblsp.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/lib/$LIB/liblsp.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/lib/$LIB/liblsp.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/lib/$LIB/liblsp.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/lib/$LIB/liblsp.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
1551441977454 mozrunner::runner INFO Running command: "/snap/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.kvmA0GU2ZdrC"
ERROR: ld.so: object '/lib/$LIB/liblsp.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/lib/$LIB/liblsp.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
/snap/firefox/185/bin/desktop-launch: line 174: /home/addohm/snap/firefox/common/.config/user-dirs.dirs: No such file or directory
ERROR: ld.so: object '/lib/$LIB/liblsp.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
cp: cannot create regular file '/home/addohm/snap/firefox/common/.config/': Not a directory
/snap/firefox/185/bin/desktop-launch: line 177: /home/addohm/snap/firefox/common/.config/user-dirs.dirs.md5sum: No such file or directory
/snap/firefox/185/bin/desktop-launch: line 177: /home/addohm/snap/firefox/common/.config/user-dirs.locale.md5sum: No such file or directory
ERROR: ld.so: object '/lib/$LIB/liblsp.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/lib/$LIB/liblsp.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/lib/$LIB/liblsp.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/lib/$LIB/liblsp.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/lib/$LIB/liblsp.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"
(firefox:27487): Gtk-WARNING **: Error loading theme icon 'dialog-warning' for stock: Icon 'dialog-warning' not present in theme Pocillo
There is no ~/snap/firefox/common/.config/
but there is a ~/snap/firefox/current/.config/
.
Solution
It seems this issue is directly related to having installed Firefox
using Snap instead of apt
.
Reference: https://ubuntuforums.org/showthread.php?t=2398478
It worked right out of the gate with no specific profile.
Unfortunately if you install Firefox using the in-built software package manager, it will install via snap. So just be careful of that and install with:
sudo apt install firefox
Answered By - addohm
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.