user19162059
user19162059

Reputation: 31

How do I run Firefox browser with undetected_chromedriver in Python?

I'm trying to open a Firefox browser with undetected_chromedriver. But only getting a default Firefox browser instead of getting the url I provided. What did I miss or do wrong?

Here is the code I made so far.

import undetected_chromedriver as uc
import time

if __name__ == '__main__':
    driver_path = "C:/Users/jay/Desktop/py/geckodriver.exe"
    Firefox_path = "C:/Program Files/Mozilla Firefox/firefox.exe"

    option = uc.ChromeOptions()
    option.binary_location = Firefox_path
    driver = uc.Chrome(executable_path=driver_path, options=option)


    driver.get('https://google.com')

    time.sleep(10)

I'd appreciate it if you could help me with this.

Upvotes: 2

Views: 4042

Answers (1)

furas
furas

Reputation: 142641

undetected_chromedriver is ONLY for chromedriver.

It modifies values directly inside binary file chromedrive.exe and it doesn't know how to modify values inside file geckodriver.exe.


See also repo GitHub - undetected-chromedriver.

There is:

  • "Works ... on .... Chromium based browsers".
  • "Automatically downloads the driver binary and patches it."

It means it automatically uses chromedrive.exe and it can't even use geckodriver.exe. And chromedrive.exe doesn't know how to communicate with Firefox - so it can't open page.

You can use it only with browsers which use engine Chromium - like Brave and maybe Opera, Microsoft Edge (but I didn't test it).

Upvotes: 3

Related Questions