| 123456789101112131415161718192021 |
- import time
- import re
- from selenium import webdriver
- from bs4 import BeautifulSoup
- DRIVER_PATH = "/Users/michaeltang/.wdm/drivers/chromedriver/88.0.4324.96/mac64/chromedriver"
- URL = "https://www.bcit.ca/"
- # This loads webdriver from the local machine if it exists.
- browser = webdriver.Chrome(DRIVER_PATH)
- browser.get(URL)
- # Give the browser time to load all content.
- time.sleep(4)
- search = browser.find_element_by_css_selector("#site-header-search")
- search.send_keys("Analytics")
- # Find the search button - this is only enabled when a search query is entered
- button = browser.find_element_by_css_selector(".site-header__search-btn")
- button.click() # Click the button
|