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.
How to initiate a Chromium based Vivaldi browser session using Selenium and Python
4.8k Views Asked by LeviR At
4
There are 4 best solutions below
1
On
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")
2
On
For future reference:
to make Vivaldi work with selenium you need to make sure of three things :
- The correct version of ChromeDriver
- Set selenium's driver to use Vivaldi's binary via
webdriver.ChromeOptions() - 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
0
On
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
If the vivaldi binary by default is located at
C:\Users\levir\AppData\Local\Vivaldi\Application\vivaldi.exeyou can use the following solution: