Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium geckodriver: profile missing: your firefox profile cannot be loaded

I am using geckodriver in the following code:

import time
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
url = 'https://www.idealista.com/venta-viviendas/barcelona/eixample/la-dreta-de-l-eixample/?ordenado-por=fecha-publicacion-desc'
options = Options()
options.headless = False
driver = webdriver.Firefox(options=options, executable_path='/home/kevin/Desktop/Inmosoft/geckodriver')
driver.get(url)
time.sleep(10)

but everytime i try to execute i have this error:

enter image description here

I've tried to create another profile in firefox by using firefox -P following the information in this link https://support.mozilla.org/en-US/kb/how-run-firefox-when-profile-missing-inaccessible.

It looks like geckodriver is a complete different instance than firefox and it does not uses the same profile, how can i bypass this error and create a profile when using geckodriver?

like image 327
Blackhole Avatar asked Sep 03 '25 15:09

Blackhole


2 Answers

I have had the same problem. In my case I am using ubuntu 22.04 and the problem is that firefox is installed by default with snap. The solution has been to uninstall firefox and install it without snap. Here is a link to do this.

remove snap firefox and install it as .dev

like image 151
Ivan Rico Avatar answered Sep 05 '25 14:09

Ivan Rico


TL/DR; Set a custom TMPDIR https://github.com/mozilla/geckodriver/issues/2010

Find the test that is booting the geckodriver and crashing e.g.

bundle exec rspec spec/features/sessions_spec.rb

When the job fails kill it via

ctrl+z # push job to background
kill %% # kill last job

# to kill all jobs do: sudo kill -9 `jobs -p -s`

Set a custom temporary directory via direnv like so:

# .envrc

export TMPDIR="$HOME/tmp/some-project"

You must create the directory via mkdir -p ~/tmp/some-project

like image 24
Marlen T. B. Avatar answered Sep 05 '25 15:09

Marlen T. B.