Skip to content

Instantly share code, notes, and snippets.

@passivebot
Created April 19, 2021 19:41
Show Gist options
  • Save passivebot/91d726bafc1f08eb475dd8384a3f21db to your computer and use it in GitHub Desktop.
Save passivebot/91d726bafc1f08eb475dd8384a3f21db to your computer and use it in GitHub Desktop.
Selenium with Python: Tutorial on Automating Brave. Brave Browser and Webdriver Manager
# Required libraries
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from webdriver_manager.chrome import ChromeDriverManager
# Define Brave path
brave_path = "C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe"
options = webdriver.ChromeOptions()
options.binary_location = brave_path
# Create new automated instance of Brave
driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
# Access Passivebot
driver.get("https://www.passivebot.com")
# Display Webtitle
print(driver.title)
# Access Google
driver.get("https://www.google.com")
# Find searchbar using element name
search_bar = driver.find_element_by_name("q")
# Clear the searchbar
search_bar.clear()
# Enter Earn Bitcoin with Web Automation Passivebot in the search bar
search_bar.send_keys("Earn Bitcoin with Web Automation Passivebot")
# Initiate search
search_bar.send_keys(Keys.RETURN)
# Display URL of webpage
print(driver.current_url)
# Close automated instance of Brave
driver.close()
@Mipp01
Copy link

Mipp01 commented Jul 29, 2024

how to use this code?

@DevEzro
Copy link

DevEzro commented Sep 2, 2024

@Mipp01 yo just have to run the file

@Mipp01
Copy link

Mipp01 commented Sep 2, 2024

might need some help on video tutorial?
me = yes pls ;-;

@DevEzro
Copy link

DevEzro commented Sep 2, 2024

@Mipp01 Easy than that.

  • Install Python
  • Download the file or copy and paste the raw file in a txt file. Make sure to change the extension of the file (.txt to .py) and double click on it (you can open a terminal and type on the file path python brave_test.py)
  • Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment