In Robotic Automation 8.0 there is an "All" property on web pages in Universal adapters. According to the documentation it contains "a collection of all the HTML elements contained in the webpage." This seems quite useful. I'm at a point where I can read the values of any element on a page. However, I can't figure out if there is a way to convert the elements to WebControl's (or some other type of object) so I can raise events and set attributes.
The All.AllItems property returns array of VirtualObject's. Is there a way to convert a VirtualObject to a WebControl or similar object that allows changing the attributes and firing events?
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
You would need to cast any objects inside of a script as there really isn't a way to do that in an automation. What would be the benefit of iterating all HTML elements on the page versus matching specific ones and interacting with them? It seems like you might just be trading matching (identifying which controls you wanted to interact with) in the adapter for your own matching at Runtime (which would likely be a lot slower).
I tried casting it to a WebControl with a script, but it results in an error. It seems a intermediate step may be required.
We have a lot of ASO only applications. While matching will be slower, it could save us development time if we reused a single generic adapter. Also, we could make changes more quickly and without doing a deployment if our match rules were defined via a remotely hosted config file or database.
You need to cast it to an OpenSpan.Adapters.Web.WebBase.Targets.VirtualHtmlElementTarget. That will allow you to interact with all of the properties of the control. I just used a Label to do my casting.
It looks like there was a slight change to this in a recent update. I notice in Studio 8.0.1056 the Get and GetItem methods are no longer available on Item and AllItems properties. My example won't work, but yours will. The objects have to be extracted before the Get method can be used now.