unibrementypo3auto/content/set_wizard_section.py

25 lines
696 B
Python
Raw Permalink Normal View History

2023-05-14 01:05:04 +02:00
from selenium import webdriver
from selenium.webdriver.common.by import By
from content.get_list_wizard_sections import get_list_wizard_sections
import time
def set_wizard_section(
driver: webdriver.firefox.webdriver.WebDriver, target: str | None
):
if target is None:
return
active_element, labels = get_list_wizard_sections(driver)
while labels[active_element] != target:
found_element_list = driver.find_elements(By.TAG_NAME, "a")
for i in found_element_list:
if i.text == target:
i.click()
time.sleep(1)
break
active_element, labels = get_list_wizard_sections(driver)
return