Page 1 of 2
Flash/Flex documentation/code samples
Posted: Tue Apr 03, 2012 3:12 pm
by robert_butler
Hi,
New here, trying to do a proof of concept of Ranorex against our Flash/Flex applications. How do I spit out values of text fields? Eventually, I want to save these values to an XLS or CSV file.
This did not work:
FlexElement textTextInput = "/dom[@domain=REMOVEDFORPRIVACY]/body/flexobject/container[@id='view']/element/container/container/container/container[@type='Canvas']/container/container/container[2]/container[@id='_EmployeeSummary_DetailsTile1']/text[@id='valueBox']";
WinForms.MessageBox.Show(textTextInput["value"]);
Thanks,
Bob
Re: Flash/Flex documentation/code samples
Posted: Tue Apr 03, 2012 3:37 pm
by Support Team
Hi,
to access the text value of your text adapter you can use the TextValue property:
WinForms.MessageBox.Show(textTextInput.TextValue);
robert_butler wrote:Eventually, I want to save these values to an XLS or CSV file.
Therefore please have a look at e.g. following site:
http://social.msdn.microsoft.com/Forums ... db45627f99
Regards,
Tobias
Ranorex Team
Re: Flash/Flex documentation/code samples
Posted: Tue Apr 03, 2012 3:52 pm
by robert_butler
I get the following error?
'Ranorex.FlexElement' does not contain a definition for 'TextValue' and no extension method 'TextValue' accepting a first argument of type 'Ranorex.FlexElement' could be found (are you missing a using directive or an assembly reference?) (CS1061)
Re: Flash/Flex documentation/code samples
Posted: Tue Apr 03, 2012 4:27 pm
by Support Team
Hi,
sorry, I haven't seen that you use the FlexElement adapter.
Please try to use the Text adapter instead:
Text textTextInput = "/dom[@domain=REMOVEDFORPRIVACY]/body/flexobject/container[@id='view']/element/container/container/container/container[@type='Canvas']/container/container/container[2]/container[@id='_EmployeeSummary_DetailsTile1']/text[@id='valueBox']";
WinForms.MessageBox.Show(textTextInput.TextValue);
Regards,
Tobias
Ranorex Team
Re: Flash/Flex documentation/code samples
Posted: Tue Apr 03, 2012 4:36 pm
by robert_butler
Thank you! That works.
Question, when do I use the FlexElement adapter in the coding? The element would be listed as a FlexElement type adapter in the repository?
Re: Flash/Flex documentation/code samples
Posted: Tue Apr 03, 2012 6:45 pm
by robert_butler
Another question:
If I am going to loop through many iterations (test cases) and want to spit out the data values for each test case to the same csv file, is there a way to store these values until the end, then write them all to the csv file?
Thanks!
Re: Flash/Flex documentation/code samples
Posted: Thu Apr 05, 2012 7:15 pm
by Support Team
Hi,
robert_butler wrote:Question, when do I use the FlexElement adapter in the coding?
With the FlexElement adapter you can set and get most common attributes of the controls as describes in following chapter of our user guide (see heading "How to read/set attributes and styles"):
Flash/Flex Testing
For more details about Ranorex Adapters please have a look at following chapter of our user guide:
Ranorex UI Adapter
robert_butler wrote:If I am going to loop through many iterations (test cases) and want to spit out the data values for each test case to the same csv file, is there a way to store these values until the end, then write them all to the csv file?
The easiest way to fill a csv file with values over several iterations is to append line by line to the csv file.
As shown in the link provided before.
Regards,
Tobias
Ranorex Team
Re: Flash/Flex documentation/code samples
Posted: Thu Apr 05, 2012 8:28 pm
by robert_butler
Thanks, I used the following to create the csv file (this link was within your link above):
http://www.blackbeltcoder.com/Articles/ ... files-in-c
I did end up appending, but had to add the following to the code in the article above:
public CsvFileWriter(string filename, bool append)
: base(filename, append)
{
}
My next question is, how do I skip steps (modules or test cases) based on an input variable?
Re: Flash/Flex documentation/code samples
Posted: Thu Apr 05, 2012 8:37 pm
by Support Team
Hi,
you can start several modules from user code.
Doing so, you can conditional start modules based on variables.
The code might look something like following code snippet:
if (myVar.Equals("True"))
{
Recording1.Start();
}
else
{
Recording1.Start();
}
To learn ho to add a variable to user code please have a lok at following chapter of our user guide:
Using Variables with Code Modules
Regards,
Tobias
Ranorex Team
Re: Flash/Flex documentation/code samples
Posted: Thu Apr 05, 2012 9:15 pm
by robert_butler
This not working as I expected. Let's assume I have 3 recordings. I add a code module with variable and code below:
if (myVar.Equals("True"))
{
Recording1.Start();
}
else
{
Recording2.Start();
}
I would expect if myVar equals "True" it would go to Recording1 then Recording2, etc. It is not. It performs Recording1 twice.
Then, if myVar does not equal "True" it does go to Recording2, but then it goes back to Recording1. I want to go to Recording2 then Recording3, etc.
Thanks for your help
Re: Flash/Flex documentation/code samples
Posted: Fri Apr 06, 2012 7:37 am
by Support Team
Hi,
what does your test suite look like?
Do the recording modules also occur in your test suite and are the checked to be executed?
Please make suer, that the recording modules will not be executed by the test suite but only by the code module.
Regards,
Tobias
Ranorex Team
Re: Flash/Flex documentation/code samples
Posted: Fri Apr 06, 2012 2:54 pm
by robert_butler
ok, so group the "conditional" recordings into test case(s) then uncheck the test case and handle by the user code?
i will try that, thanks
Re: Flash/Flex documentation/code samples
Posted: Fri Apr 06, 2012 3:33 pm
by robert_butler
so I added a new test case under my existing test case, added the conditional module to that new test case, and unchecked it. however, now the bound variable is no longer working, it is using the default value. it says it is bound.
Re: Flash/Flex documentation/code samples
Posted: Tue Apr 10, 2012 8:27 am
by Support Team
Hi,
No, what i meant is, that the recordings do not occur in your Test Suite.
The should be started from your code module.
Regards,
Tobias
Ranorex Team
Re: Flash/Flex documentation/code samples
Posted: Tue Apr 10, 2012 2:50 pm
by robert_butler
Ok, so if I remove the recording module executed by user code from the test suite, how do I let that recording module use a data variable from data source used in test suite? Can I change recording module to take a parameter?