Question

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.

Comments

Keep up to date on this post and subscribe to comments

Pega
December 17, 2016 - 10:23am

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:

  1. 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
  2. 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

December 19, 2016 - 10:10am
Response to jeffbadger

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. 

Pega
December 23, 2016 - 11:54pm

Do you have a sample of the html?