简体   繁体   中英

Setting up a profile and binary for Firefox in Python Selenium won't open a browser

As the title says when i set a profile and binary and then input them into webdriver.Firefox, no browser is open. I have looked for hours and found no ways to solve this. Any help would be appreciated.

Code I've tried:

binary = FirefoxBinary("D:\\Program Files\\Mozilla Firefox\\firefox.exe")
profile = FirefoxProfile("D:\\SYC\\fireFox\\Project\\lp5w3va5.PythonBot")
driver = webdriver.Firefox(profile, binary)
binary = FirefoxBinary("D:\\Program Files\\Mozilla Firefox\\firefox.exe")
profile = FirefoxProfile("D:\\SYC\\fireFox\\Project\\lp5w3va5.PythonBot")
driver = webdriver.Firefox(firefox_profile=profile, firefox_binary=binary)
binary = FirefoxBinary("D:\\Program Files\\Mozilla Firefox\\firefox.exe")
profile = FirefoxProfile("D:\\SYC\\fireFox\\Project\\lp5w3va5.PythonBot")
driver = webdriver.Firefox(firefox_profile=profile, firefox_binary=binary, executable_path="D:\\Python\\geckodriver.exe")

Running this code (even with driver.get) will not display any webbrowser. I do not get any errors when compiling this code. I am honestly just stuck on how I can get this to work,

Doing

driver = webdriver.Firefox()

will start up a browser with a temp profile with no settings (each time I run the script, a different temp profile is created).

Any ideas on why this is happening?

Edit: For clarification, I have geckodriver install in my python folder. Running a web browser with a profile works perfectly fine.

Edit: Solved it. The problem was that putting the profile in my D: drive created a remote dir, but I needed a local dir. Which I had to put my profile with my other profiles in my C: Drive

try to download mozilla driver Drivers

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