I'm trying to fill a value in the text field and click a button using selenium + HtmlUnitDriver + Geb.
Following is my code
import geb.Browser;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
RoFlow {
def browser = new Browser()
browser.driver = new HtmlUnitDriver()
Browser.drive {
def websiteOpened = false
go "http://www.google.com"
websiteOpened = $(name: "q").isDisplayed()
println websiteOpened // printing true
println $("input",name:"q")
// printing [<input class="lst lst-tbb sbibps" id="lst-ib" maxlength="2048" name="q" autocomplete="off" title="Search" type="text" value="" aria-label="Search" />]
$("input",name:"q").value("Groovy") // throwing exception
$("input",name:"btnG").click()
}
}
when i run the above code, i'm getting the following exception
java.lang.NoSuchMethodError: com.gargoylesoftware.htmlunit.html.HtmlInput.setValueAttribute(Ljava/lang/String;)Lcom/gargoylesoftware/htmlunit/Page;
at org.openqa.selenium.htmlunit.HtmlUnitWebElement.clear(HtmlUnitWebElement.java:268)
at geb.navigator.NonEmptyNavigator.setInputValue(NonEmptyNavigator.groovy:741)
at geb.navigator.NonEmptyNavigator.setInputValues_closure40(NonEmptyNavigator.groovy:711)
at groovy.lang.Closure.call(Closure.java:423)
at geb.navigator.NonEmptyNavigator.setInputValues(NonEmptyNavigator.groovy:710)
at geb.navigator.NonEmptyNavigator.value(NonEmptyNavigator.groovy:448)
at iobtest.run_closure1$_closure2(iobtest.groovy:16)
at iobtest.run_closure1$_closure2(iobtest.groovy)
at geb.Browser.drive(Browser.groovy:1061)
at geb.Browser.drive(Browser.groovy:1031)
at iobtest.run_closure1(iobtest.groovy:10)
at iobtest.run_closure1(iobtest.groovy)
at com.bankbazaar.roboarm.delegate.RoboArmScriptExecutor.executeBBFlow_closure1$_closure2(RoboArmScriptExecutor.groovy:24)
at iobtest.run(iobtest.groovy:7)
- geb - 0.13.1
- selenium - 2.44.0
- selenium-htmlunit-driver - 2.44.0
let me know if i'm doing anything wrong.