Page 1 of 1

HTML 5 tags do not inherit from WebElement?

Posted: Wed Jan 14, 2015 1:58 pm
by bellew.mike
(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

Re: HTML 5 tags do not inherit from WebElement?

Posted: Fri Jan 16, 2015 3:00 pm
by Support Team
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
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

Re: HTML 5 tags do not inherit from WebElement?

Posted: Fri Jan 16, 2015 4:05 pm
by bellew.mike
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

Re: HTML 5 tags do not inherit from WebElement?

Posted: Fri Jan 16, 2015 4:34 pm
by krstcs
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!

Re: HTML 5 tags do not inherit from WebElement?

Posted: Mon Jan 19, 2015 3:18 pm
by Support Team
Hi krstcs,

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

Regards,
Markus