Why we are unable to call a method

My Code as below

def response = WS.sendRequest(findTestObject(‘ManagePerson’))

String responseText = response.getResponseText()

println(‘Response body:’ + responseText)

methodSplit(‘LakshmiNarayana’);

def methodSplit(String enter) {

String attributeText = enter.split(’ ')

println(attributeText.length)

}

Note: I have written sample example, getting error like “Getting errors, please fix the errors in script” while running. But I have not seen any wrong over here.

Did you check out the “Problems” tab (next to “Console” and “Log Viewer”):

If there are errors in script, little red “x” icon will show.
In my experience, there are usually some ) or ] or } missing. :slight_smile:
(Or there is too much of them)

2018-05-15_11-33-34.png

Hmm I’ve no problems using your script. Can you post the whole full script including import statements? And also check above answer to see if there are any problems

Hi All,

Thanks for the reply, I found the root for the issue

Error line: Import java.lang.*;

Instead of * above we have to specify the class, then only we
could able to access methods inside the specified class

Correct code: Import
java.lang.String;