简体   繁体   中英

How to load a existing FirefoxProfile through Selenium and Python

First time posting here, so I address a problem I cannot solve.Checked Stackoverflow and google. There's some answers for java which I couldn't decode. Therefore you might mention that this is a duplicate, but so far no one answered such a question.

Any ideas will be really appreciated.

from selenium import webdriver
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile

from selenium.webdriver.firefox.firefox_binary import FirefoxBinary 
binary = FirefoxBinary(r'C:\Program Files (x86)\MozillaFirefox\firefox.exe')
profile = FirefoxProfile(r'C:\Users\User\Documents\dxcwavid.Zydrius5')
driver = webdriver.Firefox(firefox_profile = profile, firefox_binary = binary)
driver.get("http://google.com")

geckodriver: 0.23.0

python: 3.7.1

selenium: 3.141.0

Windows: 10 1511

Try with:

binary = FirefoxBinary("C:\Program Files (x86)\MozillaFirefox\firefox.exe")
profile = FirefoxProfile("C:\Users\User\Documents\dxcwavid.Zydrius5")
driver = webdriver.Firefox(firefox_profile=profile, firefox_binary=binary)
driver.get("http://google.com")

To load an existing Firefox Profile through Selenium and Python you can use the following solution:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM