Hi there.
I'm looking for a way to refresh the repository during test execution.
The reason is this:
I have a checkbox listed in the repository, which can never be found during execution. Once I abort execution and open the spy through the repository however, the element can be found and the 'highlight' option highlights the element without any problems.
The reason this checkbox cannot be found is that it's dynamically generated once a certain value is chosen from a listbox. It doesn't exist before the value from the listbox has been selected. I already tried a small delay or clicking on a random element on the page first to give it some time to detect the checkbox.
Start
[SUCCES] - Open page
[SUCCES] - Click dropdown
[SUCCES] - Choose value (either with invoke action or with a mouse 'click')
-- the checkbox is generated --
[FAIL] - Check Checkbox (either with invoke action or with a mouse 'click')
Abort test
Once aborted, if I choose to 'Run Selected Items' on the 'check checkbox' step that had failed during prior execution, it works. Because, in this case, the checkbox already exists (as it was generated during the first, failed execution):
Start
[SUCCES] - Check Checkbox (either with invoke action or with a mouse 'click')
The problem seems to be that Ranorex 'indexes' all the elements on the page once it opens, and fails to update its repository once this checkbox is dynamically generated.
What I'm looking for is the c# command to refresh the repository.
Thanks in advance, have a nice weekend,
Arnout
Windows 7
Ranorex 6.0 (most recent version)
Application I'm testing against: Oracle Forms 11
Refreshing repository in C# during execution
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Refreshing repository in C# during execution
Hi Arnout,
Usually, the UI element is searched at the same moment as it's accessed (for example, before the click action is executed). I assume that the issue is caused by the folder caching mechanism.
Please try disabling the option Use Cache for the corresponding parent element in the repository.
Please let me know if this resolves the issue.
Sincerely,
Johannes
Usually, the UI element is searched at the same moment as it's accessed (for example, before the click action is executed). I assume that the issue is caused by the folder caching mechanism.
Please try disabling the option Use Cache for the corresponding parent element in the repository.
Please let me know if this resolves the issue.
Sincerely,
Johannes
You do not have the required permissions to view the files attached to this post.
Re: Refreshing repository in C# during execution
Hello Johannes,
Thanks for your reply, I've checked the properties of the parent folder and the caching seems to be switched off/false. It was so by default. Is there any way for me to check the debug build if it actually builds with this as true due to some kind of bug?
Best regards,
Arnout
Thanks for your reply, I've checked the properties of the parent folder and the caching seems to be switched off/false. It was so by default. Is there any way for me to check the debug build if it actually builds with this as true due to some kind of bug?
Best regards,
Arnout
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Refreshing repository in C# during execution
Hi Arnout,
If the property is set to false, the issue doesn't seem to be related to folder caching. I would suggest contacting us by email in order to schedule a short remote session ([email protected]).
Alternatively, you could try creating a Ranorex Snapshot of the AUT during runtime after the checkbox was generated and before the mouse click is performed. This could be done with the Report.Snapshot action. Consequently, you could check if the checkbox exists in general.
Sincerely,
Johannes
If the property is set to false, the issue doesn't seem to be related to folder caching. I would suggest contacting us by email in order to schedule a short remote session ([email protected]).
Alternatively, you could try creating a Ranorex Snapshot of the AUT during runtime after the checkbox was generated and before the mouse click is performed. This could be done with the Report.Snapshot action. Consequently, you could check if the checkbox exists in general.
Sincerely,
Johannes
You do not have the required permissions to view the files attached to this post.
Re: Refreshing repository in C# during execution
Hi Arnout,
I was faced with a similar situation. What I did was created a repository item that represented all available check boxes. I would create a list of adapters after the check box appeared. Then I looped through the list until the desired check box adapter was found.
Here's an example of the code I would use. It would be in a method that would return a Ranorex.Checkbox.
I would call this method after selecting an item on the listbox.
Hope that helps.
I was faced with a similar situation. What I did was created a repository item that represented all available check boxes. I would create a list of adapters after the check box appeared. Then I looped through the list until the desired check box adapter was found.
Here's an example of the code I would use. It would be in a method that would return a Ranorex.Checkbox.
Code: Select all
List<Ranorex.Checkbox> myListOfCheckBox = allCheckBoxInfo.CreateAdapters<Ranorex.Checkbox>();
for (Ranorex.Checkbox oneCheckBox in myListOfCheckBox)
{
if (oneCheckBox == "SOME TYPE OF VALIDATION)
return oneCheckBox;
}
Hope that helps.
Re: Refreshing repository in C# during execution
Hrm, the solution to this problem was to change the identification of the checkbox from attribute ID to Index. The ID seemed to change every time the checkbox is generated. Overlooking this is a beginner's mistake that I haven't made in a long time. I thought I double-checked this.
Well, thanks everybody for trying to help (and sorry for wasting your time).
Cheers,
Arnout
Well, thanks everybody for trying to help (and sorry for wasting your time).
Cheers,
Arnout