Add files via upload

This commit is contained in:
David Rotermund 2023-05-13 03:37:09 +02:00 committed by GitHub
parent 320238b757
commit 69e5cbd4c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,32 @@
from selenium import webdriver
from selenium.webdriver.common.by import By
def get_input_fields(
driver: webdriver.firefox.webdriver.WebDriver,
) -> tuple[list, list]:
extract_list: list[str] = ["header", "date", "header_link", "subheader"]
results: list = [None] * len(extract_list)
found_element_list = driver.find_elements(By.TAG_NAME, "input")
for i in found_element_list:
value = str(i.get_attribute("value"))
temp_str = i.get_dom_attribute("data-formengine-input-name")
if temp_str is not None:
data_lines = temp_str.split("[")
if len(data_lines) > 0:
data = data_lines[-1]
if len(data) > 1:
data = data[:-1]
else:
data = None
try:
idx = extract_list.index(data)
except ValueError:
idx = None
if idx is not None:
results[idx] = value
return extract_list, results