简体   繁体   中英

Python Selenium and FireFox \ geckodriver

I am currently trying to use selenium on a new machine and I am running into the problem and error of:

selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: %s If you specified a log_file in the FirefoxBinary constructor, check it for details

I have read the following post about this and I can't seem to get this to work.

I am just using a simple test of:

from selenium import webdriver
browser = webdriver.Firefox()
browser.get('https://google.com')

I am using:

Firefox version 51.0.1 (32-bit)

I have tried both selenium version 2.53.6 and 3.0.2

I have tried to download the Geckodriver and added to the system variable path.

Can someone please tell me what I am doing wrong. Should I use an older version of selenium or am I doing something wrong with the driver?

Any help here will be great.

Just had the same issue.

Here is how I resolved it.

  1. Uninstall Selenium
  2. Install it again with pip install selenium
  3. Install Geckodriver with Homebrew: brew install Geckodriver
  4. Append the hombrew install Geckodriver path to your driver instantiation: driver = webdriver.Firefox(executable_path='/usr/local/bin/geckodriver')

Hope this helps

use my script to install all software and test installation

https://github.com/ultimosparc/work_samples

Regards, Sparc

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