如何在selenium中使用javascript选择下拉列表? 定期存款种类 再投资(累计) 四分之一支付 每月支出 短期存款

如何在selenium中使用javascript选择下拉列表? 定期存款种类 再投资(累计) 四分之一支付 每月支出 短期存款,selenium,selenium-chromedriver,Selenium,Selenium Chromedriver,如何在此下拉列表中选择“每月付款”?尝试以下java解决方案: <div class="inpt-slider"> <h4 class="fdNames block">Type of Fixed Deposit</h4> <div class="typeOf selArrow"> <select id="FdepType"> <option value="Cumulative">Reinves

如何在此下拉列表中选择“每月付款”?

尝试以下java解决方案:

<div class="inpt-slider">
  <h4 class="fdNames block">Type of Fixed Deposit</h4>
  <div class="typeOf selArrow">
    <select id="FdepType">
        <option value="Cumulative">Reinvestment (Cumulative)</option>
        <option value="Quaterly Payout">Quaterly Payout</option>
        <option value="Monthly Payout">Monthly Payout</option>
        <option value="Short Term FD">Short Term Deposit</option>
    </select>
</div>

我正在用java编写代码。我使用selenium中的javascript executor来实现这一点。这是一个网站,请尝试上述解决方案。它工作正常。。非常感谢选择文本=新选择(元素);->这行是什么意思?“Select”是Selenium WebDriverits中的一个类,用于在下拉列表中选择选项。通过将下拉webElement作为参数传递给构造函数来初始化对象。
  System.setProperty("webdriver.chrome.driver", "chromedriver.exe");

        WebDriver driver = new ChromeDriver();
        driver.get("https://www.axisbank.com/retail/calculators/fd-calculator"); // URL in the browser
        driver.manage().window().maximize(); // Maximize the browser



        WebElement element = driver.findElement(By.id("FdepType"));
        Select text = new Select(element);
        text.selectByValue("Monthly Payout");