Page 1 of 1

Tag 'tag' inside 'A' tag??

Posted: Sat Jan 29, 2011 11:41 am
by WajdaW
I have strange problem...
I defined RxPath for my table relative to tbody tag:

Code: Select all

tr/td/a[@innertext='{0}']/../../td[{1}]/a[1]
but it seems that this goes only with left aligned values in table, this RxPath cannot find my right aligned values, such as integer, double, unsigned types...
I used ranorex spy to determine path to right aligned elements and it seems that those elements have additional 'tag' after 'a' tag. This is what ranorex spy have generated:

Code: Select all

tr[21]/td[2]/a/tag[@innertext='12']
I then tried to make RxPath like this one to search only right aligned elemetns:

Code: Select all

tr/td/a[@innertext='{0}']/../../td[{1}]/a[1]/tag
But when I run tests in Nunit, Ranorex.CapabilityNotSupportedException is thrown with following text: The element does not support the required capability 'atag'.

That search for values MUST be relative to tbody tag, so I cannot use Host.FindSingle(...);
But something like this:

Code: Select all

ATag factUri = ReportFactoryAddInGuiElements.ReportPane.TableBody.FindSingle( "tr/td/a[@innertext='integer item']/../../td[2]/a[1]/tag", 600000);

factUri.Click(factUri.Element.Location);
How can I find those right aligned values in table?

Edit: Heh, I have solved it like a minute after posting, I just used another element to search for, I used WebElement insteed ATag. :)

I have now another question, can I somehow make my RxPath universal for both left and right aligned elemetns?

Regards,

Vajda Vladimir

Re: Tag 'tag' inside 'A' tag??

Posted: Mon Jan 31, 2011 4:25 pm
by Support Team
Hi,

About the
"But when I run tests in Nunit, Ranorex.CapabilityNotSupportedException is thrown with following text: The element does not support the required capability 'atag'."
You get this exception because you try to cast a "tag" to an "Atag" and this is not possible, because "tag" is not an "Atag". WebElement works because all elements inside a website are WebElements. Please take a look to following documentation
http://www.ranorex.com/support/user-gui ... apter.html
WajdaW wrote:How can I find those right aligned values in table?
You can check the alignment of the value using the "align" property in your RxPath. To check for example all right aligned elements, use following RxPath on your table
/dom[@page='test.html']/body/table/tbody//td[@align='right']
WajdaW wrote:I have now another question, can I somehow make my RxPath universal for both left and right aligned elemetns?
You want to check both alignments or you want to use one RxPath for both variables?
/dom//td[@align='right' or @align='center']
or
/dom//tb[@align='alignVariable']
Regards,
Peter
Ranorex Team

Re: Tag 'tag' inside 'A' tag??

Posted: Sat Feb 05, 2011 4:30 pm
by WajdaW
I tried and it won't work.
I need something like: give me first child element that has text.

Something like: //td[2]/child:text() but this doesn't working
or give me first child at lowest level...

Is there anything like that?

Re: Tag 'tag' inside 'A' tag??

Posted: Sun Feb 06, 2011 11:03 am
by Support Team
WajdaW wrote:Is there anything like that?
Sure, you can use regular expressions in your RanoreXPath. E.g. the following relative RanoreXPath will get you the first descendant element which "InnerText" attribute has at least one character in it:

Code: Select all

.//*[@innertext~'.+']
Please, see the following section in the Ranorex User Guide for more information on how to use regular expressions in RanoreXPath:
http://www.ranorex.com/support/user-gui ... html#c2463

Regards,
Alex
Ranorex Team

Re: Tag 'tag' inside 'A' tag??

Posted: Sun Feb 06, 2011 5:33 pm
by WajdaW
Thanks a lot Alex, you're a life saver. :)
I appended

Code: Select all

//*[@innertext~'[^ ]+']
to my root path and works just as I wanted.
I only needed to add exclude for whitespace because there are a lot of elements with innertext that contains whitespace.

Regards,

Vajda Vladimir