def find_and_select_random_radio_and_click_next(driver: WebDriver): parent_div_radio_element = driver.find_element_by_class_name("m-b-xs") time.sleep(2) child_radio_div_elements = parent_div_radio_element.find_elements_by_xpath("//input[@type='radio']"); RADIO_SELECTORS_DICT = {} for index in range(len(child_radio_div_elements)): child_radio_element = child_radio_div_elements[index] key_name = "radio" + str(index) radio_element_xpath = f"//input[@id='" + str(child_radio_element.get_attribute("id")) + "']" key_value = Selector(By.XPATH, radio_element_xpath, type=ElementType.RADIO) if index == 0: rsdict = {} rsdict[key_name] = key_value RADIO_SELECTORS_DICT["product radio info"] = rsdict else: rsdict = RADIO_SELECTORS_DICT["product radio info"] rsdict[key_name] = key_value RADIO_SELECTORS_DICT.clear() RADIO_SELECTORS_DICT["product radio info"] = rsdict radio_selectors = RADIO_SELECTORS_DICT["product radio info"] check_random_radio(driver, radio_selectors) nextbtnclick(driver)
def fill_out(driver: WebDriver, details: dict): form_selectors = SELECTORS["form"] check_random_radio(driver, form_selectors) fill_out_input_fields(driver, form_selectors, details)