def visit_ibmbraceorjp( user: UserInformation, driver: webdriver.remote.webdriver.WebDriver, timeout: int = 15, ) -> bool: """Visit and login to im.mbrace.or.jp. Args: user (UserInformation): user information driver (webdriver.remote.webdriver.WebDriver): webdriver timeout (int, optional): timeout parameter. Defaults to 15. Returns: bool: whether login is succeeded. """ # check if not check_login_status(driver): login(driver, user, timeout) # visit driver.get(IBMBRACEORJP) # check return driver.title == 'トップ - BOAT RACE インターネット投票'
def mail_transactions(driver: webdriver.remote.webdriver.WebDriver) -> None: driver.get('https://app.finpension.ch/documents/transactions') wait = WebDriverWait(driver, 30) mail_the_csv_button = wait.until( expected_conditions.element_to_be_clickable( (By.CSS_SELECTOR, 'ion-icon.ux-documents-item__mail'))) mail_the_csv_button.click()
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 go_to_reports_page(driver: webdriver.remote.webdriver.WebDriver) -> None: driver.get( "https://www.interactivebrokers.co.uk/AccountManagement/AmAuthentication?action=Statements" ) # Wait for the page to load driver.find_element_by_xpath( "//*[normalize-space(text()) = 'MTM Summary']/../../..")
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 login(driver: webdriver.remote.webdriver.WebDriver, user: UserInformation, timeout: int = 15, logger: Logger = getLogger(__name__)) -> bool: """Login to boatrace.jp Args: driver (webdriver.remote.webdriver.WebDriver): webdriver. user (UserInformation): User information. timeout (int, optional): Timeout parameter. Defaults to 15. logger (Logger, optional): logger. Defaults to getLogger(__name__). Raises: LoginFailException: Occurred when login failure. Returns: bool: Whether login is succeeded. NOTE: Behavior: Return True when login is succeeded; Raise LoginFailException when login is failed. """ # get driver.get(BOATRACEJP_LOGIN_URL) # send keys WebDriverWait(driver, timeout).until( EC.presence_of_element_located((By.NAME, 'in_KanyusyaNo'))) driver.find_element_by_css_selector('input[name="in_KanyusyaNo"]')\ .send_keys(user.userid) logger.debug('put userid') WebDriverWait(driver, timeout).until( EC.presence_of_element_located((By.NAME, 'in_AnsyoNo'))) driver.find_element_by_css_selector('input[name="in_AnsyoNo"]')\ .send_keys(user.pin) logger.debug('put user pin') WebDriverWait(driver, timeout).until( EC.presence_of_element_located((By.NAME, 'in_PassWord'))) driver.find_element_by_css_selector('input[name="in_PassWord"]')\ .send_keys(user.auth_pass) logger.debug('put authentification password') # press button WebDriverWait(driver, timeout).until( EC.presence_of_element_located((By.CLASS_NAME, 'is-type3_2'))) driver.find_element_by_css_selector('button[class="btn is-type3_2"]')\ .click() logger.debug('Pressed login button') is_successed = check_login_status(driver) if not is_successed: raise LoginFailException() return is_successed
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: 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: """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 logout( driver: webdriver.remote.webdriver.WebDriver, logger: Logger = getLogger(__name__) ) -> bool: """Logout from boatrace.jp Args: driver (webdriver.remote.webdriver.WebDriver): webdriver logger (Logger, optional): logger. Defaults to getLogger(__name__). Returns: bool: Whether logout is succeeded. """ # logout driver.get(BOATRACEJP_LOGOUT_URL) return not check_login_status(driver)
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 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 check_login_status( driver: webdriver.remote.webdriver.WebDriver, logger: Logger = getLogger(__name__), ) -> bool: """[summary] Args: driver (webdriver.remote.webdriver.WebDriver): webdriver logger (Logger, optional): logger. Defaults to getLogger(__name__). Returns: bool: Whether you are loggined in boatrace.jp """ # get driver.get(BOATRACEJP_MAIN_URL) if driver.find_elements_by_class_name('is-logout1'): return True else: return False
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)