I am trying to write a program that loads a webpage in Selenium and then scroll to the bottom of that page. Currently, my program can load the page but cannot scroll to the bottom of it. Below is my full code. Any help will be greatly appreciated, thanks!
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait as wait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from bs4 import BeautifulSoup
from selenium.webdriver.chrome.options import Options
from pynput.mouse import Button, Controller
import time
mouse = Controller()
chrome_options = Options()
chrome_options.add_argument("--user-data-dir=chrome-data")
driver = webdriver.Chrome(r"C:\Users\Brian\Downloads\chromedriver.exe", options=chrome_options)
driver.get('https://www.tradingview.com/chart/lUsimB6z/')
time.sleep(5)
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
#open("source.html", "w").write(str(html))
