Created
May 21, 2022 13:09
-
-
Save davidliyutong/7494493ca2793bd0be03d948b6221605 to your computer and use it in GitHub Desktop.
This file contains 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
from selenium import webdriver | |
from selenium.webdriver.common.by import By | |
import time | |
import os | |
from credentials import USER_EMAIL, USER_PASSWD, PROJECT_URL | |
download_path = os.getcwd() | |
options = webdriver.EdgeOptions() | |
options.use_chromium = True | |
options.add_experimental_option('prefs', {'download.default_directory':download_path}) | |
driver = webdriver.Edge(options=options) | |
driver.implicitly_wait(30) | |
driver.get(PROJECT_URL) | |
form = driver.find_elements(By.CLASS_NAME,"form-group") | |
form[0].find_element(By.NAME, "email").clear() | |
form[0].find_element(By.NAME, "email").send_keys(USER_EMAIL) | |
form[1].find_element(By.NAME, "password").clear() | |
form[1].find_element(By.NAME, "password").send_keys(USER_PASSWD + "\n") | |
menu = driver.find_element(By.XPATH, "//*[@id=\"chat-wrapper\"]/div[1]/header/div[1]/a[1]/p") | |
menu.click() | |
download_button = driver.find_element(By.XPATH, "//*[@id=\"left-menu\"]/ul[1]/li[1]/a") | |
download_link = download_button.get_attribute('href') | |
print("link: ", download_link) | |
driver.get(download_link) | |
time.sleep(30) | |
driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment