Does Interpreted Java (Beanshell) in screen scraper support enhance for loop and class declaration?

int [] array = new int [] { 1, 2, 3 };

for( i : array )
        system.logError(i);

gives me a
The error message was: class bsh.ParseException (line 3): :-- Encountered ":" at line 3, column 8.

also
class Item()
{
        Item();
        String desc = "";
       
        getDesc() {
                return desc;
        }
        setDesc(String s) {
                desc = s;
        }
}

Item item = new Item();
item.setDesc("123");

session.logError(item.getDesc());

gives me
The error message was: class bsh.ParseException (line 1): class-- Encountered "class" at line 1, column 1.

I can't get a foreach to work

I can't get a foreach to work in Beanshell. I must always use a for or a while loop.

Test-Scraper, You're not able

Test-Scraper,

You're not able to use enhanced for-loops because we are using version 1.2 of Beanshell. We have plans to upgrade at some point but not at least until the next public release which could be a few months away.

Beanshell 1.2 Manual.

You are able to use classes within your scripts. You just need to omit the word class in your declaration. Give that try and see if that works.

For a pretty replete set of very useful classes and methods take a look at the General Utility script created by our developer Mike (Great job Mike!).

-Scott