0

How can I change the search engine in a browser in Selenium Python? I want the default search engine to be DuckDuckGo but can't figure out how to do this. It would be nice if someone could provide how to do it in Chrome, Firefox, etc.

Armster
  • 772
  • 1
  • 9
  • 25

1 Answers1

0

In order to use different browsers, you need to download a webdriver for this. Let's take for example Firefox - his driver is called geckodriver, for Chrome - it is chromedriver. You download it and then apply it with selenium. Here is an example:

Linux

from selenium import webdriver
 
driver = webdriver.Firefox('/path/to/driver/geckodriver')
driver.get("http://www.google.com")

Windows

from selenium import webdriver
 
driver = webdriver.Firefox('C:\\Files\\geckodriver.exe')
driver.get("http://www.google.com")

Unfortunately, I don't think there is any driver for DuckDuckGo.

Igor Dragushhak
  • 567
  • 1
  • 3
  • 14