Selenium WebDriver to select combo-box item?

后端 未结 4 1879
情深已故
情深已故 2020-12-31 05:41

We are using Selenium WebDriver and JBehave to run \"integration\" tests on our web-app. I have a method that will enter a value into a form input.

@When(\         


        
4条回答
  •  被撕碎了的回忆
    2020-12-31 06:05

    This is how to do it:

    @When("I select $elementId value $value")
    public void selectComboValue(final String elementId, final String value) {
        final Select selectBox = new Select(web.findElement(By.id(elementId)));
        selectBox.selectByValue(value);
    }
    

提交回复
热议问题