Posted: 16 Dec 2016 16:55 EST Last activity: 23 Aug 2018 19:03 EDT
Accessing each item and sub item using object model. (GetClones)
I am trying to get data from webpage using object model. Lets say a dynamic list of DIV and it contains labels. I wanted to iterate each Div and read the label inside it.
I was able to match all DIV and set the property UseKeys. Then I use the method GetClones to loop each DIV's. For each DIV I wanted to read each controls inside it. How do I do it with automation and object model.
**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.
Is the structure under each DIV the same? What type of controls are you looking to work with underneath the DIV? Currently, there are two ways to do what you are interested in but both are advanced concepts and choosing the method depends on the answer to those questions.
I would recommend before you get into advanced concepts that you attempt to interrogate the sections you actually need individually. If that will not work then looking at an advnaced method will be required.
The two methods are:
writing a script to parse the innerHtml of the DIV and output the values you need - this will not allow you to change values and could be complex based on the page structure
interrogate the DIV and the controls that appear underneath it and then directly edit the adapter file to move the controls under the DIV in the control hierarchy - this may not be necessary but often is as input fields often are placed on a Form in the hierarchy - this feature will be enabled through the product in a future release and should be done only after you understand the structure of the adapter
I am already doing the method 1. Where I get full html in xml and using xpath get each inner item. I am trying to avoid method 1.
Method 2 is what i am interested.
The controls could be a link <a> tag, <span> tag. For example some details for each state in US. So there will be 50 div. And I wanted to get state name from each DIV and number of some counts. And description of it. So when i interoggate i can get 1st DIV and make clones. But inside this each DIV i wanted to use object model and get the lable text.