Tag 'tag' inside 'A' tag??

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
WajdaW
Posts: 75
Joined: Wed Jan 05, 2011 6:45 pm

Tag 'tag' inside 'A' tag??

Post by WajdaW » Sat Jan 29, 2011 11:41 am

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

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

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

Post by Support Team » Mon Jan 31, 2011 4:25 pm

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
.
Image

WajdaW
Posts: 75
Joined: Wed Jan 05, 2011 6:45 pm

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

Post by WajdaW » Sat Feb 05, 2011 4:30 pm

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?

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

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

Post by Support Team » Sun Feb 06, 2011 11:03 am

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
.
Image

WajdaW
Posts: 75
Joined: Wed Jan 05, 2011 6:45 pm

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

Post by WajdaW » Sun Feb 06, 2011 5:33 pm

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