我需要利用 se素进行 j瓦试验,通过在线平台自动进行,我无法找到从某个下游名单上选择的办法。 我曾尝试过几部法典。 但是,使用<代码>Selectdown = 新的选择性(driver.findElement(By.id("id_of_the_dropdown_list”);作为该守则的基础没有发挥作用,而是试图:
SelenideElement menueGesamt = $(By.id("id_of_the_dropdown_list"));
ElementsCollection optionen = menueGesamt.findAll(By.cssSelector("option"));
int maxRandom = optionen.size();
int random = new Random().nextInt(maxRandom);
SelenideElement gewaehlteOption = optionen.get(random);
String optionValue = gewaehlteOption.getAttribute("value");
menueGesamt.selectOptionByValue(optionValue);
但这也无所作为。 没有任何错误,但选择不选择。 图像显示应发生什么情况,应选择选择方案,然后倒塌的菜单应关闭。