filter of table with python and selenium (select option)

16 views Asked by At

I'm trying filtering table with select option. I tried use DropDown select method but it's only choose but not click in this element. But I need action like directly click in this element (then filters start) . I tried like below but without success.

def set_filter_select(driver, selectInputId, text="",  translation_dict=None):


for status_key, translation in translation_dict.items():
    for lang_key, lang_value in translation.items():
        if lang_value == text:
            text = status_key
            print("status key", status_key)
            break

list = clickableWait(driver, selectInputId)
if list:
    select = findElement(list, "select", By.TAG_NAME)
    if select:
        options = findElements(select, "option", By.TAG_NAME)
        for option in options:
            print(option)
            if option.get_attribute("value") == text:
                print("text key", text)
                if not option.is_selected():
                    option.click() 
                    list.send_keys(Keys.ENTER)
                break
return True, None
0

There are 0 answers