No such property error

HI,

I have tried to run the following code

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config" scriptlang="groovy">
    <robotics-flow>
        <robot driver="universal" close-on-completion="true" start-in-private="true">
            <capability name="SEARCH_ALL_WINDOWS" value="true" />
            <script><![CDATA[
                import com.workfusion.studio.rpa.recorder.api.internal.representation.*
                import com.workfusion.studio.rpa.recorder.api.*
                import com.workfusion.studio.rpa.recorder.api.types.*
                import com.workfusion.studio.rpa.recorder.api.custom.*
                import static com.workfusion.studio.rpa.recorder.api.RandomValues.CharacterSet.*
 
 
 				source_type_list=RList.of('aa','aa','CBRS','jsh','JJH','ndbj')
 				import_id_list=RList.of('22','24','4944','34','76','1')
 				import_date_list=RList.of('Nov 2, 2019','Nov 2, 2019','Nov 6, 2019','Nov 2, 2019','Nov 2, 2019','Nov 2, 2019')
 				import_id_list=RList.of('Yes','Yes','Yes','Yes','Yes','Yes')
 				row_size=RNumber.of(6)
 				import_id=RNumber.of(0)
 				current_date=RString.of('Nov 6, 2019')
 				
 				def customScript()
 				{
 				for(int i=0;i<=row_size;i++)
 				{
 					def source = source_type_list.get(i)
 					
 					
 					if(source==CBRS)
 					{
 						def import_date = import_date_list.get(i)
 						if (import_date==current_date)
 						{
 						def success = source_type_list.get(i)
 						if(success==Yes)
 						{
 						 import_id = import_id_list.get(i)
 						 break
 						}
 						}	
 					}
 				}		
 				}
 						customScript()
 						print import_id
 				
  
            ]]></script>
        </robot>
    </robotics-flow>
    <export include-original-data="true"/>
</config>

I get the following error:
12:36:36 [INFO] RoboticsFlowPlugin starts processing…
12:36:36 [INFO] SeleniumCapabilityPlugin starts processing…
12:36:36 [INFO] SeleniumCapabilityPlugin processor executed in 1ms.
12:36:36 [INFO] RobotPlugin starts processing…
12:36:36 [INFO] SeleniumCapabilityPlugin starts processing…
12:36:36 [INFO] SeleniumCapabilityPlugin processor executed in 0ms.
Nov 06, 2019 12:36:36 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
12:36:36 [INFO] SeleniumCapabilityPlugin starts processing…
12:36:36 [INFO] SeleniumCapabilityPlugin processor executed in 0ms.
12:36:36 [INFO] ScriptProcessor starts processing…
12:36:40 [WARN] [urn:uuid:76C8CB65179DB679B615730239960243] robotics-flow plugin execution exception : org.webharvest.exception.ScriptException:
Config line 6: script block
groovy.lang.MissingPropertyException: No such property: CBRS for class: Script1
org.webharvest.exception.PluginException: org.webharvest.exception.ScriptException:
Config line 6: script block
groovy.lang.MissingPropertyException: No such property: CBRS for class: Script1
at com.freedomoss.crowdcontrol.webharvest.plugin.selenium.RobotPlugin.executePlugin(RobotPlugin.java:185)
at org.webharvest.runtime.processors.WebHarvestPlugin.execute(WebHarvestPlugin.java:125)
at org.webharvest.runtime.processors.BaseProcessor.run(BaseProcessor.java:127)
at org.webharvest.runtime.processors.BodyProcessor.execute(BodyProcessor.java:27)
at org.webharvest.runtime.processors.WebHarvestPlugin.executeBody(WebHarvestPlugin.java:246)
at com.freedomoss.crowdcontrol.webharvest.plugin.selenium.RoboticsFlowPlugin.executePlugin(RoboticsFlowPlugin.java:110)
at org.webharvest.runtime.processors.WebHarvestPlugin.execute(WebHarvestPlugin.java:125)
at org.webharvest.runtime.processors.BaseProcessor.run(BaseProcessor.java:127)
at org.webharvest.runtime.Scraper.execute(Scraper.java:169)
at org.webharvest.runtime.Scraper.execute(Scraper.java:182)
at com.freedomoss.crowdcontrol.webharvest.executor.LocalWebharvestTaskExecutor.executeWebHarvestTask(LocalWebharvestTaskExecutor.java:173)
at com.workfusion.studio.launch.SingleThreadWebHarvestProcess.processTaskInputs(SingleThreadWebHarvestProcess.java:77)
at com.workfusion.studio.launch.SingleThreadWebHarvestProcess.start(SingleThreadWebHarvestProcess.java:46)
at com.workfusion.studio.launch.WebHarvestMainLauncher.launch(WebHarvestMainLauncher.java:108)
at com.workfusion.studio.launch.WebHarvestMainLauncher.main(WebHarvestMainLauncher.java:180)
Caused by: org.webharvest.exception.ScriptException:
Config line 6: script block
groovy.lang.MissingPropertyException: No such property: CBRS for class: Script1
at org.webharvest.runtime.scripting.GroovyScriptEngine.eval(GroovyScriptEngine.java:138)
at org.webharvest.runtime.processors.ScriptProcessor.execute(ScriptProcessor.java:74)
at org.webharvest.runtime.processors.BaseProcessor.run(BaseProcessor.java:127)
at org.webharvest.runtime.processors.BodyProcessor.execute(BodyProcessor.java:27)
at org.webharvest.runtime.processors.WebHarvestPlugin.executeBody(WebHarvestPlugin.java:246)
at com.freedomoss.crowdcontrol.webharvest.plugin.selenium.RobotPlugin.executePlugin(RobotPlugin.java:178)
… 14 more
Caused by: groovy.lang.MissingPropertyException: No such property: CBRS for class: Script1
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:67)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:51)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:310)
at Script1.customScript(Script1.groovy:29)
at Script1.run(Script1.groovy:42)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:444)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:482)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:453)
at org.webharvest.runtime.scripting.GroovyScriptEngine.eval(GroovyScriptEngine.java:136)
… 19 more

Please help me on this

Your custom script is wrong. You can find a template of a custom script here
https://kb.workfusion.com/display/RPAe/Script+as+Custom+Action#ScriptasCustomAction-InWorkFusionStudio(Optional)

1 Like

I have changed the code and now it’s running fine:

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config" scriptlang="groovy">
    <robotics-flow>
        <robot driver="universal" close-on-completion="true" start-in-private="true">
            <capability name="SEARCH_ALL_WINDOWS" value="true" />
            <script><![CDATA[
                import com.workfusion.studio.rpa.recorder.api.internal.representation.*
                import com.workfusion.studio.rpa.recorder.api.*
                import com.workfusion.studio.rpa.recorder.api.types.*
                import com.workfusion.studio.rpa.recorder.api.custom.*
                import static com.workfusion.studio.rpa.recorder.api.RandomValues.CharacterSet.*
 
 
 				source_type_list=RList.of('aa','aa','CBRS','jsh','JJH','ndbj')
 				import_id_list=RList.of('22','24','4944','34','76','1')
 				import_date_list=RList.of('Nov 5, 2019','Nov 2, 2019','Nov 6, 2019','Nov 2, 2019','Nov 2, 2019','Nov 2, 2019')
 				success_type_list=RList.of('Yes','Yes','Yes','Yes','Yes','Yes')
 				row_size=RNumber.of(6)
 				import_id=RNumber.of(0)
 				current_date=RString.of('Nov 6, 2019')
 				
 				/*@CustomScriptAction(
   							input = ['source_type_list','import_id_list','import_date_list','success_type_list','row_size','current_date'],   
   							output = 'import_id'
						)
						*/
 				
 				def customScript()
 				{
 				for(int i=0;i<=row_size;i++)
 				{

 					def s1 = RString.of('CBRS')
 					if(source_type_list.get(i).equals(s1))
 					{
 						def import_date = import_date_list.get(i)
 						println import_date
 						if (import_date.equals(current_date))
 						{
 							def s3=RString.of('Yes')
 							if(success_type_list.get(i).equals(s3))
 							{
 						 		import_id = import_id_list.get(i)
 								 break
 							}
 						}	
 					}
 				}		
 				}
 						customScript()
 						println import_id
 				
  
            ]]></script>
        </robot>
    </robotics-flow>
    <export include-original-data="true"/>
</config>

Thank you :relaxed:

1 Like