HTML 5 tags do not inherit from WebElement?

Class library usage, coding and language questions.
bellew.mike
Posts: 10
Joined: Wed Jan 14, 2015 1:20 pm

HTML 5 tags do not inherit from WebElement?

Post by bellew.mike » Wed Jan 14, 2015 1:58 pm

(Ranorex Version: 5.1.2.19431)

Hi,

I have noticed that the new 'html5' tags do not inherit from a WebElement, like all the older tags do, they inherit directly from Adapter. (e.g. SectionTag, NavTag, CanvasTag, ...)

I only ask as I have created a few generic functions the take a WebElement as a parameter and noticed they were failing when passed a SectionTag.

Just wondering if this was a reason for this and/or if there is a fix in a later version or on the backlog.

Thanks in advance,
Mike

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

Re: HTML 5 tags do not inherit from WebElement?

Post by Support Team » Fri Jan 16, 2015 3:00 pm

Hi Mike,

In order to use the new elements in your method you just need to change the Adapter Type to WebElement in the Properties window of the specific repository items as shown below:
SelectionTag.png
SelectionTag.png (12.55 KiB) Viewed 1079 times
The new elements do also support the WebElement addapter so you shouldn't face any issues after you changed the Adapter Type in the repository.

Regards,
Markus
.
Image

bellew.mike
Posts: 10
Joined: Wed Jan 14, 2015 1:20 pm

Re: HTML 5 tags do not inherit from WebElement?

Post by bellew.mike » Fri Jan 16, 2015 4:05 pm

Thank you for your reply.

Unfortunatly, as im sure you hear a lot, we are not using the default ranorex repository and have our own inplementaion, so that fix will not work for us.

However, your reply gave me an idea;
Change the function to accept an Element then do "element.As<WebElement>();".

This has solved my issue :D

I still find it unexpected that this does not inherit from WebElement by default but at least my code now works.

Thanks a lot and have a nice day,
Regards,
Mike

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: HTML 5 tags do not inherit from WebElement?

Post by krstcs » Fri Jan 16, 2015 4:34 pm

Markus,

I would think that this is a bug on the Ranorex side. All other HTML tag elements inherit from WebElement (which inherits from Adapter).

The HTML 5 tags should also inherit from WebElement unless there is a reason not to do so. If there is a reason, could you explain it to us?

Thanks!
Shortcuts usually aren't...

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

Re: HTML 5 tags do not inherit from WebElement?

Post by Support Team » Mon Jan 19, 2015 3:18 pm

Hi krstcs,

You're right, this should be fixed with 5.3.

Regards,
Markus
.
Image