从列表框中选择值时遇到问题
<select name="max">
<option value="25">25</option>
<option value="50" selected="selected">50</option>
<option value="100">100</option>
</select>
在我的页面中,我有:
class TableSectionModule extends Module {
static base = { $('#runList') }
static content = {
tablePaginationSelect { $("select", name : "max") }
}
}
我在我的规范中使用了所有这些调用:
runs.table.tablePaginationSelect = "100"
我也试过这个:
runs.table.tablePaginationSelect.value('100')
但我有一个例外
org.openqa.selenium.WebElement.setSelected()V
java.lang.NoSuchMethodError: org.openqa.selenium.WebElement.setSelected()V
at org.openqa.selenium.support.ui.Select.selectByValue(Select.java:176)
at geb.navigator.NonEmptyNavigator.setSelectValue(NonEmptyNavigator.groovy:591)
at geb.navigator.NonEmptyNavigator.setInputValue(NonEmptyNavigator.groovy:548)
at geb.navigator.NonEmptyNavigator.setInputValues_closure33(NonEmptyNavigator.groovy:542)
at geb.navigator.NonEmptyNavigator.setInputValues(NonEmptyNavigator.groovy:541)
at geb.navigator.NonEmptyNavigator.value(NonEmptyNavigator.groovy:319)
at geb.content.NavigableSupport.methodMissing(NavigableSupport.groovy:123)
at geb.content.NavigableSupport.propertyMissing(NavigableSupport.groovy:141)
我将 Grails 与 Geb 一起使用,这是我正在使用的依赖项:
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
// runtime 'mysql:mysql-connector-java:5.1.22'
test("org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion")
test("org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion")
// You usually only need one of these, but this project uses both
//test "org.codehaus.geb:geb-spock:$gebVersion"
test "org.spockframework:spock-grails-support:0.7-groovy-2.0"
test "org.gebish:geb-spock:0.9.0"
test "org.codehaus.geb:geb-spock:0.7.2"
test "org.seleniumhq.selenium:selenium-support:2.0a7"
}