Page 1 of 1

Setting Element Attribute in User Code

Posted: Wed Dec 11, 2013 5:32 pm
by saad.ayub
Hi All,

A noob question.

I have an element in the ranorex repository which has an attribute set to a variable.
eg:
//Column[@text=$varcolumnname]
This Variable has a default value assigned to it "Ccy" in the repo.

Can someone tell me how i can go about setting this variable to something else in user code?
eg: "Name"

I'm thinking i can use the setattributevalue on the element but not sure what the code should be.

Re: Setting Element Attribute in User Code

Posted: Thu Dec 12, 2013 2:50 pm
by krstcs
If you just want to change the value of the variable, you can just assign the variable a new value in user code. It is just a .NET string variable type.

Code: Select all

varcolumnname = "Name";
You have to have declared the variable in the test module you are using it in.

Also, you need to remember that this will set the variable to the new value for all future uses, until the value is set again.