Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Selenium tests on the Brave web browser?

Tags:

I am trying to run some Selenium tests on the Brave web browser. I am able to start the Brave web browser through Selenium by using the ChromeDriver. However, nothing else works, e.g. I cannot cause Brave to load a certain web page.

As Brave is based on Chromium, I would think this is the way to go. Are there more appropriate ways that support Brave to be driven by Selenium?

This is de code that I used:

    ChromeOptions options = new ChromeOptions().setBinary("/Applications/Brave.app/Contents/MacOS/brave");     WebDriver driver = new ChromeDriver(options); 
like image 836
Barney Kelly Avatar asked Nov 07 '17 12:11

Barney Kelly


People also ask

Does Selenium support brave?

I am able to start the Brave web browser through Selenium by using the ChromeDriver. However, nothing else works, e.g. I cannot cause Brave to load a certain web page. As Brave is based on Chromium, I would think this is the way to go.

Which browser is used for Selenium?

Through WebDriver, Selenium supports all major browsers on the market such as Chrome/Chromium, Firefox, Internet Explorer, Edge, Opera, and Safari.


2 Answers

For the record: this is no longer an issue since Brave went full-Chromium (starting from version 0.57). I can now pass instructions to the WebDriver by initializing it using the code snippet included in the question.

Nevertheless, be sure to check that your ChromeDriver version is compatible with your Brave Browser version.

like image 67
Barney Kelly Avatar answered Sep 23 '22 00:09

Barney Kelly


System:
macOS Catalina 10.15.2
Python 3.7.4
pytest 5.3.2
selenium 3.141.0
ChromeDriver 79.0.3945.36
Brave 1.1.23 Chromium: 79.0.3945.88 (Official Build) (64-bit)

from selenium import webdriver from selenium.webdriver.chrome.options import Options  options = Options() options.binary_location = '/Applications/Brave Browser.app/Contents/MacOS/Brave Browser' driver_path = '/usr/local/bin/chromedriver' drvr = webdriver.Chrome(options = options, executable_path = driver_path) drvr.get('https://stackoverflow.com') 

Reference:
Set chrome browser binary through chromedriver in Python

like image 21
datalifenyc Avatar answered Sep 25 '22 00:09

datalifenyc