Flash/Flex documentation/code samples

Ask general questions here.
User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Flash/Flex documentation/code samples

Post by Support Team » Wed Apr 11, 2012 2:28 pm

Hi,

Do you want to use the global parameters from the test suite or do you want to use the data source variables of a specific test case? Are the data sources bound to a specific User Code/Repository variable?
Please send us more information about the structure of your solution/test case/data sources?

Thanks in advance!

Regards,
Markus
Ranorex Support Team
.
Image

robert_butler
Posts: 24
Joined: Tue Apr 03, 2012 3:05 pm

Re: Flash/Flex documentation/code samples

Post by robert_butler » Wed Apr 11, 2012 3:03 pm

I want to use the data source variables of a specific test case (iteration). This data is coming from a CSV file.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Flash/Flex documentation/code samples

Post by Support Team » Thu Apr 12, 2012 3:04 pm

Hello!

if you want to run recording modules from code and the recording modules are not embedded in any Test Case, the common way of binding module-variables does not work since the data binding is always at the Test Case level for child module elements.

You can do a small workaround to connect your module variables to external data as well:
In your code module (mandatory) which does the conditional run of the (optional) recording module:

1.) Just create a new Module Variable (you can use the "Insert Module variable" functionality which is accessible via the context menu).

2.) Modify the setter-method and add a new code line that assigns the new value directly to the variable you want to bind from the optional recording !

3.) Now, you are able bind the variable from your mandatory code module in the common way in your Test Suite in the current Test Case. The setter-method of that variables cares for assigning the values of the current iteration directly to the variable used in your optional recording module.
string _varFromMandatoryModule = "MyDefaultValue";
[TestVariable("3B21E451-A103-4D20-A68C-BFFB499B25CB")]
public string varFromMandatoryModule
{
	get { return _varFromMandatoryModule; }
        set { 
		_varFromMandatoryModule = value; 
		OptionalRecordingTwo.Instance.varFromOptionalRecording = _varFromMandatoryModule;
	     }
}
Hope that helps !

Kind regards,
Roland (E)
Ranorex Support Team
.
Image

robert_butler
Posts: 24
Joined: Tue Apr 03, 2012 3:05 pm

Re: Flash/Flex documentation/code samples

Post by robert_butler » Thu Apr 12, 2012 4:41 pm

This worked great! Thanks!

robert_butler
Posts: 24
Joined: Tue Apr 03, 2012 3:05 pm

Re: Flash/Flex documentation/code samples

Post by robert_butler » Fri Apr 20, 2012 7:34 pm

why does this always return "True" whether the flex element is readonly or not?

repo.WebDocumentWelcome2.TextBirthDateField.Element.Attributes.IsReadOnly.ToString()

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Flash/Flex documentation/code samples

Post by Support Team » Mon Apr 23, 2012 8:34 am

Hi,

the isReadOnly property returns if the IList .Attributes is read-only or not, and not whether the adapter is read-only.

Regards,
Tobias
Ranorex Team
.
Image

robert_butler
Posts: 24
Joined: Tue Apr 03, 2012 3:05 pm

Re: Flash/Flex documentation/code samples

Post by robert_butler » Mon Apr 23, 2012 4:14 pm

ok, I am having trouble determing if a simple text field is readonly. It is not causing the test case to fail, but it does not update the value because the field is not editable.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Flash/Flex documentation/code samples

Post by Support Team » Wed Apr 25, 2012 4:34 pm

If you are using a Flex mx.controls::TextInput or spark.components::TextInput, then you can use
repo.WebDocumentWelcome2.TextBirthDateField.Element["editable"] (true/false)
(or @editable in RanoreXPath) or Enabled (which is the grayed out variant)

For HTML Input tags also use Enabled

Michael
Ranorex Team
.
Image

robert_butler
Posts: 24
Joined: Tue Apr 03, 2012 3:05 pm

Re: Flash/Flex documentation/code samples

Post by robert_butler » Thu Apr 26, 2012 6:22 pm

Thank you, "editable" worked.

New issue, the following should find the element. However, when I run the whole test case, it does not. When I run just the recording module, it does find it. Any ideas?

Also, the element below (TryFindSingle("./element) is indexed.

Ranorex.Core.Element optGrid = repo.WebDocumentWelcome.ContainerHBox4.ElementOffering;
Ranorex.Core.Element optLabel = null;
bool found=false;
found = optGrid.TryFindSingle("./element/container/container/container/text/text[@caption='Medical Option']", out optLabel);
if (!found)
{
//throw new Ranorex.ElementNotFoundException("Option not found.", null);
}
else
{ ...}

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Flash/Flex documentation/code samples

Post by Support Team » Fri Apr 27, 2012 3:37 pm

Hi,

Maybe the search timeout is too short?
Please also send us a Ranorex Snapshot file of the specific element and the used RxPath?
You can post it here or you can also send it to our support mail address, [email protected].
Following link will show you how to generate a snapshot file:
http://www.ranorex.com/support/user-gui ... files.html

Regards,
Markus
Ranorex Support Team
.
Image

robert_butler
Posts: 24
Joined: Tue Apr 03, 2012 3:05 pm

Re: Flash/Flex documentation/code samples

Post by robert_butler » Mon Apr 30, 2012 7:15 pm

Thanks, it was the timeout. I added 30000 to the TryFindSingle method call and it worked. Not sure why since I already had 30000 in the Repository Default timeouts.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Flash/Flex documentation/code samples

Post by Support Team » Tue May 01, 2012 11:46 am

robert_butler wrote:Thanks, it was the timeout. I added 30000 to the TryFindSingle method call and it worked. Not sure why since I already had 30000 in the Repository Default timeouts.
TryFindSingle is a method which doesn't care about the repo timeout. It uses the DefaultAdapterTimeout and this is set to 10 seconds. If you use a User Code Method or similar you have to set the timeout for your search method or you increase the DefaultAdapterTimeout.

Regards,
Peter
Ranorex Team
.
Image