"MyControl" can be found with following RxPath:
/form[@controlname='ContainerForm']/element/container/container[@controlname='MyControl']
But i want it to split in:
- /form[@controlname='ContainerForm']
AND
./container[@controlname='MyControl']
OR
.//container[@controlname='MyControl']
But the control is not found in both cases. Whats wrong ? (Lacking parts of the tree is intented)
Is the interpretation of the docu correct ? :
./ = children of the current element -> only the children of the 1st level, but no further descendants
.// = descendants of the current element -> all descendants including the children of the 1st level
Thanks in advance
Jörg
Problem Splitting RxPath expressions
Re: Problem Splitting RxPath expressions
Can you post your Find/FindSingle line of code?
What error are you receiving?
Did you give enough of a timeout for the element to be found?
What error are you receiving?
Did you give enough of a timeout for the element to be found?
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
-
- Posts: 55
- Joined: Thu Aug 23, 2007 12:00 pm
Re: Problem Splitting RxPath expressions
IList<Element> forms = Host.Local.Find(new RxPath("/form[@controlname='ContainerForm']"));
form is now avl. in forms[0]
IList<Element> els = forms[0].Find(new RxPath(".//container[@controlname='MyControl']"));
no element found, els.Count = 0
timeout: if i do a single find like:
Host.Local.Find(new RxPath("/form[@controlname='ContainerForm']/element/container/container[@controlname='MyControl']"));
the method returns after 1-2 seconds the control, should not be a timeout-problem
form is now avl. in forms[0]
IList<Element> els = forms[0].Find(new RxPath(".//container[@controlname='MyControl']"));
no element found, els.Count = 0
timeout: if i do a single find like:
Host.Local.Find(new RxPath("/form[@controlname='ContainerForm']/element/container/container[@controlname='MyControl']"));
the method returns after 1-2 seconds the control, should not be a timeout-problem
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Problem Splitting RxPath expressions
The timeout should not be an issue because you do not specify one. That means Ranorex will just search the element tree once for the specified RanoreXPath.
Have you debugged the code?
Have you tried to search for the full path right above/below that code and debugged the individual lines?
Regards,
Alex
Ranorex Team
That's correct. From what I can see the split paths look ok. The only thing that could be different is that you are searching the wrong form, i.e. that the "forms" list contains more than a single form (are there more forms having that control name?). In contrast, the full path searches all possible forms with the "ContainerForm" control name.jabelshauser wrote:.// = descendants of the current element -> all descendants including the children of the 1st level
Have you debugged the code?
Have you tried to search for the full path right above/below that code and debugged the individual lines?
Regards,
Alex
Ranorex Team
-
- Posts: 55
- Joined: Thu Aug 23, 2007 12:00 pm
Re: Problem Splitting RxPath expressions
- The forms-list contains only 1 form. so the form must be right one
- The full path search is succesful. In this case, the control is found.
another test: if i use the whole spare-path, also no success.
forms[0].Find(new RxPath("./element/container/container[@controlname='MyControl']"));
- The full path search is succesful. In this case, the control is found.
another test: if i use the whole spare-path, also no success.
forms[0].Find(new RxPath("./element/container/container[@controlname='MyControl']"));
Re: Problem Splitting RxPath expressions
I agree with Alex... It *seems* that forms[0] does not contain the form you think it does...
Things I would try...
1) Run your code in debug. Put a breakpoint after you get the iList of Forms. Manually inspect the iList and check for what it contains.
2) Change from using an iList array to a single element variable so you don't ever have to worry in the future about hard coding the [0] item in that array... You never know if in the future you could run into a problem here.
3) Post a Ranorex snapshot of your AUT at this point where you are searching for the Form and Element.
Things I would try...
1) Run your code in debug. Put a breakpoint after you get the iList of Forms. Manually inspect the iList and check for what it contains.
2) Change from using an iList array to a single element variable so you don't ever have to worry in the future about hard coding the [0] item in that array... You never know if in the future you could run into a problem here.
3) Post a Ranorex snapshot of your AUT at this point where you are searching for the Form and Element.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
-
- Posts: 55
- Joined: Thu Aug 23, 2007 12:00 pm
Re: Problem Splitting RxPath expressions
update to ranorex 4 -> ok