Thanks Marcin for your help!

Looking forward to a fix so don't have to use this workaround.

Cheers,
Raza 

On Sunday, 10 November 2019 01:06:39 UTC+11, Marcin Erdmann wrote:
>
> For some reason the class you added (BindingUpdaterSupportingTextMatchers) 
> inside of the features directory is treated as a script and is being 
> instantiated using a no arg constructor which doesn't exist, most likely by 
> cucumber. When I moved the class to the bottom of the env.groovy file and 
> removed the BindingUpdaterSupportingTextMatchers.groovy file then it worked 
> for me.
>
> On Thu, Nov 7, 2019 at 6:56 AM raz <raz...@gmail.com <javascript:>> wrote:
>
>> Thanks Marcin, issue # 601 created.
>>
>> I'm trying the workaround to override the BindingUpdater but getting the 
>> following exception:
>>
>> [ERROR] Failed to execute goal 
>> org.codehaus.mojo:exec-maven-plugin:1.6.0:java 
>> (default) on project sample-test: An exception occured while executing 
>> the Java class. Failed to create Script instance for class: class 
>> features.support.BindingUpdaterSuppo
>> rtingTextMatchers. Reason: java.lang.reflect.InvocationTargetException: 
>> geb.binding.BindingUpdater: method <init>()V not found -> [Help 1]
>>
>>
>> What I did was
>> 1. created a new class *BindingUpdaterSupportingTextMatchers*
>> 2. placed your provided code in it
>> 3. updated the previous binding statement 
>> bindingUpdater = new BindingUpdater(binding, browser)
>>
>> to use the new class  
>>
>> bindingUpdater = new BindingUpdaterSupportingTextMatchers(binding, browser)
>>
>> Did I miss a step or did something incorrectly? Seems like it's looking for 
>> a blank constructor for BindingUpdater but can't find it because it doesn't 
>> exist yet??
>>
>>
>> Have also attached the project showing the changes.
>>
>>
>>
>> Thanks,
>> Raza 
>>
>> On Thursday, 7 November 2019 09:37:53 UTC+11, Marcin Erdmann wrote:
>>>
>>> This is because the binding updater does not forward methods 
>>> from geb.textmatching.TextMatchingSupport onto the Browser instance. Would 
>>> you mind creating an issue for that in the tracker at 
>>> https://github.com/geb/issues/issues?
>>>
>>> To workaround that issue you can override the BindingUpdater:
>>>
>>> @InheritConstructors
>>> class BindingUpdaterSupportingTextMatchers extends BindingUpdater {
>>>     static public final TEXT_MATCHING_FORWARDED_BROWSER_METHODS = 
>>> ["contains"]
>>>
>>>     @Override
>>>     BindingUpdater initialize() {
>>>         super.initialize()
>>>
>>>         TEXT_MATCHING_FORWARDED_BROWSER_METHODS.each {
>>>             binding.setVariable(it, new 
>>> BindingUpdater.InvocationForwarding(it, browser))
>>>         }
>>>
>>>         this
>>>     }
>>>
>>>     @Override
>>>     BindingUpdater remove() {
>>>         super.remove()
>>>
>>>         TEXT_MATCHING_FORWARDED_BROWSER_METHODS.each {
>>>             binding.variables.remove(it)
>>>         }
>>>
>>>         this
>>>     }
>>> }
>>>
>>> and use that instead of the one provided out of the box. You will 
>>> probably want to add names of additional methods from TextMatchingSupport 
>>> to TEXT_MATCHING_FORWARDED_BROWSER_METHODS if you want them to work.
>>>
>>> Another workaround would be not to use the matcher methods directly in 
>>> your steps but as part of page definitions using content DSL (
>>> https://gebish.org/manual/current/#content-dsl). As far as I can tell, 
>>> using text matcher methods in content definitions should work for you 
>>> without any changes being needed.
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Geb User Mailing List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to geb-...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/geb-user/c79b3597-c94c-4e0c-8351-be419484559e%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/geb-user/c79b3597-c94c-4e0c-8351-be419484559e%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/da86a087-0cdb-4d2a-8ea3-c69b54995df3%40googlegroups.com.

Reply via email to