6

I am trying to use the vivaldi browser with Selenium. It is a chromium browser that runs very similar to chrome. I have Selenium working with Firefox (geckodriver), and Google Chrome(chromedriver), but I can't seem to find a way with Vivaldi. Any help would be appreciated.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
LeviR
  • 99
  • 3
  • 7

4 Answers4

7

If the vivaldi binary by default is located at C:\Users\levir\AppData\Local\Vivaldi\Application\vivaldi.exe you can use the following solution:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("start-maximized")
options.binary_location=r'C:\Users\levir\AppData\Local\Vivaldi\Application\vivaldi.exe'
driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe', options=options)
driver.get('http://google.com/')
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
2

For future reference:
to make Vivaldi work with selenium you need to make sure of three things :

  1. The correct version of ChromeDriver
  2. Set selenium's driver to use Vivaldi's binary via webdriver.ChromeOptions()
  3. Make sure you're getting the correct url (don't forget "https://")

All of the above is explained step by step with screenshots in this blog post

Mossab
  • 818
  • 8
  • 13
  • 1
    Thanks for the nice article. It seems that the download page does not have all versions. For example I have vivaldi snapshot version 5.3.2656.3 (100.0.4896.133), and there is no 100.0.4896.133 in [download page](https://sites.google.com/chromium.org/driver/downloads). See also [webdriver_manager for vivaldi](https://github.com/SergeyPirogov/webdriver_manager/issues/369) request. – Ashark Apr 28 '22 at 05:24
  • 1
    As noted in download page: if you are using Chrome version 100, please download ChromeDriver 100.0.4896.60. I can use that. – Ashark Apr 28 '22 at 05:31
1

The key executable_path will be deprecated in the upcoming releases of Selenium. This post has the solution. I'm posting a copy of said solution with the path to Vivaldi, where the username is fetched by the script so you don't have to hard code it.

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
import os

current_user = os.getlogin()
s = Service(rf"C:\Users\{current_user}\AppData\Local\Vivaldi\Application\vivaldi.exe")
driver = webdriver.Chrome(service=s)
driver.get("http://duckduckgo.com")  # or your website of choice
DavidBevi
  • 61
  • 10
0

You can use ChromeOptions and supply binary.

from selenium.webdriver.chrome.options import Options


opt = Options()
opt.binary_location = chromium_path//path to chromium binary
driver = webdriver.Chrome(options=opt, executable_path="path_to_chromedriver")
Tek Nath Acharya
  • 1,676
  • 2
  • 20
  • 35
  • I have this: `from selenium import webdriver from selenium.webdriver.chrome.options import Options opt = Options() opt.binary_location = (r'C:\Users\levir\AppData\Local\Vivaldi\Application\vivaldi.exe') driver = webdriver.Chrome(chrome_options=opt)` I get this error, selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. – LeviR Jan 08 '20 at 17:52