def login(creds: Credentials, driver: webdriver.remote.webdriver.WebDriver) -> None: logging.info("Logging in.") LOGIN_PAGE = 'https://trader.degiro.nl/login/chde/#/login' driver.get(LOGIN_PAGE) driver.find_element(By.ID, "username").send_keys(creds.id + Keys.TAB) driver.find_element(By.ID, "password").send_keys(creds.pwd + Keys.RETURN)
def login(creds: Credentials, driver: webdriver.remote.webdriver.WebDriver) -> None: LOGIN_PAGE = 'https://www.bcge.ch/authen/login?lang=de' driver.get(LOGIN_PAGE) wait = WebDriverWait(driver, 30) wait.until( expected_conditions.presence_of_element_located((By.ID, 'username'))) driver.find_element(By.ID, "username").send_keys(creds.id + Keys.TAB) driver.find_element(By.ID, "password").send_keys(creds.pwd + Keys.RETURN)
def login_to_mbank(creds: Credentials, driver: webdriver.remote.webdriver.WebDriver) -> None: driver.get(MBANK_LOGIN_PAGE) driver.find_element(By.ID, "userID").send_keys(creds.id + Keys.TAB) driver.find_element(By.ID, "pass").send_keys(creds.pwd + Keys.RETURN) wait = WebDriverWait(driver, 30) wait.until( expected_conditions.element_to_be_clickable( (By.CSS_SELECTOR, '[data-test-id="SCA:UnknownDevice:OneTimeAccess"]'))).click() wait = WebDriverWait(driver, 30) wait.until(expected_conditions.url_matches(HISTORY_PAGE))
def login(creds: Credentials, driver: webdriver.remote.webdriver.WebDriver) -> None: """Logs into the Charles Schwab website""" LOGIN_PAGE = 'https://client.schwab.com/Login/SignOn/CustomerCenterLogin.aspx' driver.get(LOGIN_PAGE) driver.switch_to.frame("lmsSecondaryLogin") login_id = driver.find_element(By.ID, "loginIdInput") wait = WebDriverWait(driver, 30) wait.until(expected_conditions.visibility_of(login_id)) login_id.send_keys(creds.id + Keys.TAB) driver.find_element(By.ID, "passwordInput").send_keys(creds.pwd + Keys.RETURN) wait_for_pin_number_and_select_it(wait, driver) wait_for_user_to_provide_pin_and_login(driver)
def login(creds: Credentials, driver: webdriver.remote.webdriver.WebDriver) -> None: username_field_name = 'Benutzername' driver.get(LOGIN_PAGE) wait = WebDriverWait(driver, 30) wait.until( expected_conditions.presence_of_element_located( (By.ID, username_field_name))) driver.find_element(By.ID, username_field_name).send_keys(creds.id + Keys.TAB) time.sleep(1) pwd_field = driver.find_element(By.ID, "Passwort") pwd_field.send_keys(creds.pwd) time.sleep(1) pwd_field.send_keys(Keys.RETURN)
def fetch_portfolio(driver: webdriver.remote.webdriver.WebDriver) -> bytes: logging.info("Fetching portfolio.") portfolioSideBarLink = driver.find_element(By.CSS_SELECTOR, '[href="#/portfolio"]') portfolioSideBarLink.click() exportButton = driver.find_element(By.CSS_SELECTOR, '[data-name="exportButton"]') exportButton.click() time.sleep(1) reportExportForm = driver.find_element(By.CSS_SELECTOR, '[data-name="reportExportForm"]') csvLink = reportExportForm.find_element( By.XPATH, "//a[normalize-space(text()) = 'CSV']") csvFetchUrl = csvLink.get_attribute('href') cookies = driver_cookie_jar_to_requests_cookies(driver.get_cookies()) return fetch_csv(csvFetchUrl, cookies)
def fetch_latest_bill(driver: webdriver.remote.webdriver.WebDriver) -> bytes: driver.get('https://one.viseca.ch/de/rechnungen') driver.implicitly_wait(30) latest_bill_a_elem = driver.find_element( By.CSS_SELECTOR, '#statement-list-statement-date0 a') latest_bill_id = extract_bid(latest_bill_a_elem.get_attribute('id')) return fetch_bill(latest_bill_id, driver.get_cookies())
def fetch_account(driver: webdriver.remote.webdriver.WebDriver) -> bytes: logging.info("Fetching account.") driver.get( get_account_overview_url( from_date=get_three_months_ago(date.today()), to_date=date.today(), )) exportButton = driver.find_element(By.CSS_SELECTOR, '[data-name="exportButton"]') exportButton.click() time.sleep(1) reportExportForm = driver.find_element(By.CSS_SELECTOR, '[data-name="reportExportForm"]') csvLink = reportExportForm.find_element( By.XPATH, "//a[normalize-space(text()) = 'CSV']") csvFetchUrl = csvLink.get_attribute('href') cookies = driver_cookie_jar_to_requests_cookies(driver.get_cookies()) return fetch_csv(csvFetchUrl, cookies)
def wait_for_pin_number_and_select_it( wait: WebDriverWait, driver: webdriver.remote.webdriver.WebDriver): wait.until( expected_conditions.url_matches('https://sws-gateway.schwab.com/.*')) driver.switch_to.window(driver.window_handles[0]) pin_element = driver.find_element(By.ID, "placeholderCode") # Initially the element is findable but not clickable. When that happens, # the click operation fails, so wait for the element to be visible. wait.until(expected_conditions.visibility_of(pin_element)) pin_element.click() return pin_element
def login(creds: Credentials, driver: webdriver.remote.webdriver.WebDriver) -> None: driver.implicitly_wait(10) LOGIN_PAGE = 'https://app.revolut.com/start' driver.get(LOGIN_PAGE) form = driver.find_element(By.CSS_SELECTOR, 'form') country_code_input, phone_number_input = form.find_elements( By.CSS_SELECTOR, 'input') set_value(driver, country_code_input, creds.country_code) phone_number_input.send_keys(creds.phone_number + Keys.RETURN) fields = find_pin_input_fields(driver) fields[0].send_keys(creds.pin)
def login(creds: Credentials, driver: webdriver.remote.webdriver.WebDriver) -> None: LOGIN_PAGE = 'https://app.finpension.ch/login' driver.get(LOGIN_PAGE) phone_country_selection = driver.find_element(By.CSS_SELECTOR, ".PhoneInputCountrySelect") set_value(driver, phone_country_selection, 'CH') wait = WebDriverWait(driver, 30) mobile_number_field = wait.until( expected_conditions.element_to_be_clickable((By.ID, 'mobile_number'))) password_field = wait.until( expected_conditions.element_to_be_clickable((By.NAME, 'password'))) mobile_number_field.send_keys(creds.id + Keys.TAB) password_field.send_keys(creds.pwd + Keys.RETURN) code_field = wait.until( expected_conditions.element_to_be_clickable( (By.CSS_SELECTOR, 'ion-input[name=code]'))) code_field.click()
def login(creds: Credentials, driver: webdriver.remote.webdriver.WebDriver) -> None: LOGIN_PAGE = 'https://www.interactivebrokers.co.uk/sso/Login?RL=1' driver.get(LOGIN_PAGE) driver.find_element(By.ID, "user_name").send_keys(creds.id + Keys.TAB) driver.find_element(By.ID, "password").send_keys(creds.pwd + Keys.RETURN)