Hello,
is it the normal behavior that repo items used and referenced in user code modules get "crushed" as soon as i'm changing the the place where it is located within the object repository?
For example when i'm moving the repo item to another simple folder on another tree level in the repo hierarchy it gets partly "destroyed" and i have to fix it manually.
See the attachment for an example.
Kindly Regards and thanks in advance
julez
Repo item get's destroyed in user code after relocation in repo tree
Repo item get's destroyed in user code after relocation in repo tree
You do not have the required permissions to view the files attached to this post.
Re: Repo item get's destroyed in user code after relocation in repo tree
Hi,
Yes, that's quite normal behavior. Ranorex does not automatically update such referenced repo elements in code. This is why you should not use them directly in code, but instead to pass them to methods via repoiteminfo or adapter parameter, like this (just an example):
Where repoElement should be connected with repo item of your choice. Ideally, use RepoItemInfo, but of course, you can use directly Adapter, so there is no need to convert RepoItemInfo to Adapter in code. However, it's safer to use RepoItemInfo, because if the element does not (yet) exists at a time the test enters the method (with Adapter as a parameter), it may fail due to 'element not found' exception. This does not happen in case of RepoItemInfo! So even though it's faster to use Adapter, it's safer to RepoItemInfo
Yes, that's quite normal behavior. Ranorex does not automatically update such referenced repo elements in code. This is why you should not use them directly in code, but instead to pass them to methods via repoiteminfo or adapter parameter, like this (just an example):
Code: Select all
public static void SearchAnElement(RepoItemInfo repoElement)
{
if (repoElement.Exists(10000))
{
var foundElement = repoElement.CreateAdapter<Ranorex.Unknown>(false).FindSingle("//*[@automationid='idstring'");
...
}
}
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Repo item get's destroyed in user code after relocation in repo tree
Hey odkilzec,
thank you very much for your helpful reponse.
I will take a look on that
KG
julez
thank you very much for your helpful reponse.
I will take a look on that
KG
julez
Re: Repo item get's destroyed in user code after relocation in repo tree
I think this is a bug, if the length of the new path is not changed, then the code will work. As you can see in the screenshot, Ranorex has updated the path, but there is an error in the update.
Also you can check it:
from "repo.folder1.element1" manual move to "repo.abcd123.element1"
it will work fine after moving, all "repo.folder1.element1" in user code was update to "repo.abcd123.element1"
But if new path after move element1 will be "repo.abcd1234.element1", user code will have bug.
I have same problem in https://www.ranorex.info/repository-pat ... 2c871b2678
Also, all path in Action automatically updated, can checked with "view code" after move element.