def get_account_id(driver: webdriver.remote.webdriver.WebDriver) -> str: wait = WebDriverWait(driver, 30) wait.until( expected_conditions.presence_of_element_located( (By.TAG_NAME, 'iframe'))) driver.switch_to.frame(0) try: # We want the page to load fully. Otherwise it seems that statement # fetching doesn't work. That's why we wait for the export icon to # appear and some currency figures, because they appear relatively late # in the loading process. wait.until( expected_conditions.presence_of_element_located( (By.CSS_SELECTOR, 'fin-icon-link[label="Exportieren als PDF"]'))) wait.until( expected_conditions.presence_of_element_located( (By.CSS_SELECTOR, 'a.ribbon'))) wait.until( expected_conditions.presence_of_element_located( (By.CSS_SELECTOR, '.currency'))) ribbons = driver.find_elements(By.CSS_SELECTOR, 'a.ribbon') elem_with_account_id = ribbons[0] params = json.loads( elem_with_account_id.get_attribute('fin-ui-sref-params')) finally: driver.switch_to.parent_frame() return params['accountId']
def find_pin_input_fields(driver: webdriver.remote.webdriver.WebDriver): return driver.find_elements(By.CSS_SELECTOR, '[inputmode="numeric"]')