Im looking for a little help to have selenium use my profile for firefox
I have found my firefox profile file location: /root/.mozilla/firefox/abcdefgh.default
import time
import random
import requests
from selenium import webdriver
profile = webdriver.FirefoxProfile()
with open("proxylist.txt") as f:
proxy_list = f.read().splitlines()
proxy_ip, proxy_port = random.choice(proxy_list).split(":")
profile.set_preference("network.proxy.type", 1)
profile.set_preference("network.proxy.http", proxy_ip)
profile.set_preference("network.proxy.http_port", int(proxy_port))
profile.update_preferences()
driver = webdriver.Firefox(firefox_profile=profile)
driver.get("https://www.ipleak.net")
time.sleep(60)
driver.close()
From the documentation of webdriver.FirefoxProfile:
:args:
profile_directory: Directory of profile that you want to use. This defaults to None and will create a new directory when object is created.
So, the following should work:
profile = webdriver.FirefoxProfile('/root/.mozilla/firefox/abcdefgh.default')
driver = webdriver.Firefox(profile)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With