WindowsError: [Error 2] The system cannot find the file specified

I did a performance error opening Firefox with Selenium in ipython Notebooks, using the Firefox browser with the following code:

from selenium import webdriver
driver = webdriver.Firefox()

The error message is as follows:

The error the code returns is as follows:
    WindowsError                              Traceback (most recent call last)
<ipython-input-7-fd567e24185f> in <module>()
----> 1 driver = webdriver.Firefox()

Solutions:
When you try to initialize Firefox(), specify the Firefox binaries. The default path, FirefoxDriver, is in %PROGRAMFILES%\Mozilla Firefox\ Foxfox.exe. Specify the Firefox Driver or add the path of the Firefox binaries to the Windows path. The code to specify the firefoxdriver path is as follows:

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary('path/to/binary')
driver = webdriver.Firefox(firefox_binary=binary)

Sweep yards attention
Practical AI Inn
Get the latest AI information and practical cases

WeChat ID: langu86

Read More: