How To Run Selenium Tests In Brave Browser Using ChromeDriver?

preview_player
Показать описание
What is Brave Browser ?
Brave Browser is an open-source browser from Brave Software, Inc and this browser is based on Chromium project that is used for Chrome Browser. Until now brave browser is available for Windows, Mac, Linux, iOS and Android. But this not the USP of the Browser. Its USP is fast and ads free browsing experience. In 2021, Privacy is major concern across the world. People searches for safe browsing. Due to this people are going for either tor browsers or moving towards Brave Browser. Brave browser also supports Tor and for this user can click on hamburger menu on the top right corner of the browser.
How Selenium WebDriver communicates with Brave Browser?
Like Chrome Browser, Brave Browser also need one driver which establish the communication between Selenium WebDriver and Brave Browser. This is possible through ChromeDriver executable.. Here you will be thinking we are talking about Brave but Why we are talking about ChromeDriver. This is because, Brave Browser uses Chromium platform. For all chromium platform browsers, chromedriver executable driver is must for the communication between Selenium WebDriver and Browser. ChromeDriver acts as bridge between Selenium & Browser to run Selenium Test in Brave Browser.

So lets talk about ChromeDriver Executable Driver.
What is ChromeDriver ?
ChromeDriver is a medium between Selenium WebDriver and Brave Browser or Chrome Browser. This ChromeDriver acts as a standalone server which implements webdriver wire protocol for Chromium.

Without this driver, we could not launch Chrome or Brave Browser Using Selenium.
What are the Steps to run Selenium Tests In Brave Browser ?
Nothing extra stuff is needed to run your Selenium Tests in Brave Browser, If you have already written code to support Selenium Tests in Chrome. Same code can be used with one additional step.
So let's learn to run Selenium WebDriver Scripts In Brave Browser.
1- Since brave web browser is based on chromium project. So we need selenium chromedriver executable and which can be downloaded from official chromium project. For this executable, I will suggest you to download the latest version because version on brave goes hand to hand with Chrome Browser.
Steps to download ChromeDriver On WIndows:
b) Scroll down to Browser Section and Under Chrome Label, Click on documentation.

c) Now on Chromium Official WebPage, Navigate to All versions available in Downloads label like this and Click on ChromeDriver

This version might change when you are reading this post.

e) Unzip the zip file downloaded and copy the path. In my case, Path on my machine is
2- Brave Binary path: This is the path where brave browser exe is present on local machine. So in general path for brave will be like this ( For Windows)
3- Now is the time to call ChromeOptions class to inform ChromeDriver about chromium binary path. ChromeDriver ask this binary path during initialization of Chrome/Brave instance from some custom location othewise it will pick the default path of chrome browser exe... This time in place of Chrome binary we will be providing path of Brave Browser Binary path. So that ChromeOptions could pass information to ChromeDriver session to run Selenium Scripts On Brave Browser.
If you are thinking, what is ChromeOptions?, then let me tell you in 2-3 lines about ChromeOptions

Chrome Options in Selenium WebDriver is a class which have convenient methods which can change ChromeDriver Sessions by passing capabilities.
Рекомендации по теме
Комментарии
Автор

"what the hell this brave browser is?" 😂

maxaret