Changing command does nothing

Queries related to T-Plan Robot
Post Reply
lee.magee

Changing command does nothing

Post by lee.magee » Thu Sep 06, 2012 1:31 pm

Can anyone help with this problem I have run into using Java as the language of choice? I am creating a script, making sure it all works and then doing a save as to a different filename so that I retain the working functionality that I need.

I am then changing key commands in the script. So that the script clicks on a different field. However the updated command still clicks on the original field. In the example below the field originally selected was Price but now it should click on Term, but the code for clicking on Term is still clicking on the Price field.

For example:
Original script clicks on a field called Price, here is the code -

libClickFields.clickprice();

The procedure code is -

public int clickprice (String... args) throws IOException {
compareTo(new File[] { new File("C:\\Users\\User\\Google Drive\\Testing\\Automation\\Robot\\ImageTemplates\\PriceFieldLabel.png"), new File("C:\\Users\\User\\Google Drive\\Testing\\Automation\\Robot\\ImageTemplates\\LabelVehiclePriceError.png") }, "search2", 100.0f);
if (getContext().getExitCode() > 0) {
exit(1);
} else {
mouseClick(new Point(getVariableAsInt("_COMPARETO_CLICK_X"), getVariableAsInt("_COMPARETO_CLICK_Y")));
}
return getExitCode();
}

I am changing this procedure to the following -

libClickFields.clickterm

The procedure code is -


// Finance Term
public int clickterm (String... args) throws IOException {
compareTo(new File[] { new File("C:\\Users\\User\\Google Drive\\Testing\\Automation\\Robot\\ImageTemplates\\FinanceTerm.png") }, "search2", 100.0f);
if (getContext().getExitCode() > 0) {
exit(1);
} else {
mouseClick(new Point(getVariableAsInt("_COMPARETO_CLICK_X"), getVariableAsInt("_COMPARETO_CLICK_Y")));
}
return getExitCode();
}

rpes
User
User
Posts: 74
Joined: Thu Oct 29, 2009 5:43 pm
First Name: Robert
Last Name: Pes
Company: T-Plan

Re: Changing command does nothing

Post by rpes » Thu Sep 06, 2012 1:49 pm

It is possible that your updates introduced a syntax error into the code and it failed to compile into the .class format. The script may however succeed to run if there's a previously compiled .class file. I suppose it's just a typo but replacing of

Code: Select all

libClickFields.clickprice();
with

Code: Select all

libClickFields.clickterm
will surely show up as a syntax error. The correct call must be like

Code: Select all

libClickFields.clickterm();
.

I suggest you to right click the script editor and select "Compile" after the code change. Then make sure in the Compiler tab that the script compiled OK without any syntax errors. To ensure that the stale .class file is not in the way you may even delete it from the <projectPath>/classes folder before the compilation.

Alternatively consider editing the code in a third party IDE such as NetBeans. It will give you the option to debug the script code at a very low Java level. As Robot's project structure is cross compatible with the IDE it is quite easy to set up. See our documentation for details.

lee.magee

Re: Changing command does nothing

Post by lee.magee » Thu Sep 06, 2012 2:08 pm

Thanks, I'll give the suggestions a try and see what works.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest