I am trying to scroll Up in a whats app conversation so I record the entire chat (into csv).
chrome_options = Options()
chrome_options.add_argument("--user-data-dir=chrome-data") #saves login
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get('https://web.whatsapp.com/')
#choose converstaion
#scroll to top not working
Here is what I tried but it didn't work, Ideally I will run headless so I prefer not to use pyautogui
def scroll_to_top():
driver.execute_script("window.scrollTo(0, -document.body.scrollHeight);")
time.sleep(4)
#driver.execute_script("window.scrollTo(0, 0);")
#bd = driver.find_element_by_xpath('//body')
#bd.click()
#bd.send_keys(Keys.CONTROL+Keys.HOME) #throws element not interact-able
Any help is appreciated