Created
April 19, 2021 19:41
-
-
Save passivebot/91d726bafc1f08eb475dd8384a3f21db to your computer and use it in GitHub Desktop.
Selenium with Python: Tutorial on Automating Brave. Brave Browser and Webdriver Manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Mipp01 Easy than that.
.txt
to.py
) and double click on it (you can open a terminal and type on the file pathpython brave_test.py
)