0

I have tried everything, downloading the drivers and provided the exact path but i am getting stuck at the same point. I re installed Firefox but still the same error. below is my code:

`!pip install selenium

import os
import time
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.chrome.service import Service

options = Options()
options.headless = True
binary_path  = r('C:\Users\Shefali\webdrivers\Mozilla Firefox\firefox.exe')
os.environ['PATH'] += ';' + binary_path
service = Service(executable_path=r'C:\Users\Shefali\webdrivers\geckodriver.exe')
options.binary_location = binary_path
driver = webdriver.Firefox(service=service, options=options)`

(and the error is : Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line)

i even tried :

options.binary_location = binary_path
options.set_preference("browser.download.folderList",2)
options.set_preference("browser.download.manager.showWhenStarting", False)
options.set_preference("browser.download.dir","/Data")
options.set_preference("browser.helperApps.neverAsk.saveToDisk","application/octet-stream,application/vnd.ms-excel")
driver = webdriver.Firefox(options=firefox_options)

but still the same. Please help!!

0

1 Answer 1

0

You initialized the raw string literal incorrectly:

r('C:\Users\Shefali\webdrivers\Mozilla Firefox\firefox.exe')

should be

r'C:\Users\Shefali\webdrivers\Mozilla Firefox\firefox.exe'
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.