Issue on Element resolution with grails 2.0.1 and plugin 0.4.1

Issue #3 new
Anonymous created an issue

I have this simple scenario: a page with a message and a test.



import org.codehaus.groovy.grails.plugins.webdriver.WebDriverPage

class DummyPage extends WebDriverPage { String message

static elements = {

} }}}



class DummyTest extends FunctionalTest {

private DummyPage dummyPage

protected void setUp() {
    dummyPage ='/dummy', DummyPage.class)

protected void tearDown() {

public void testDummy() {
    println webdriver.driver.findElement("message"))
    assertEquals("Dummy message", dummyPage.message)

} }}}



<div id="message">Dummy message</div> }}}

when I execute the test I got this failure

expected:<[Dummy message]> but was:[org.codehaus.groovy.grails.plugins.webdriver.WebDriverPageElement@43b149e1]

This kind of test used to work on grails 1.3.7 and webdriver 0.3.3

Comments (1)

  1. Anonymous

    I'm having the same problem with Grails 2.0.3, Groovy 1.8.6 on Mac OS Lion. I found out that the method WebDriverPageElement.asType(Class type) never gets called but should when method ElementLookupRegistry.getElementValue(WebElement x, LookupDetails result, Class type) is calling it at line 235 -> return e.asType(type ?: WebElement.class) In my opinion the reason is the WebDriverComponent.invokeMethod(String name, args) method that does not find the asType method above in def validMethod = metaClass.getMetaMethod(name, args*.class as Class[]) but the method ConvertersApi.asType(Object instance, Class<?> clazz) That's why the toString()-method of the WebDriverPageElement gets called.

    This makes the plugin not really usable! Is there anyone able to fix that?

  2. Log in to comment