how to get child properties of the div object for rational functinal tester - rft

in my application i have a dropdown which is div object.the dropdown contain names and checkboxes.i need select the checkbox based on name. checkbox dont have any name.just index.can any one suggest how to get chaild items or properties of the objects for div object.
and the second question is i have tree view .which is teleric object.RFT is unable to find the object.it identifying as one all tree view is one object.its not identifying the childs,sub tree items....
so please help me on this two issues.

Hi you can get the checkboxes as follows:
void getCheckBoxes(TestObject parentDiv)
{
TestObject[] checkboxes = parentDiv.find(atDescendant(".class","Html.INPUT.checkbox"));
System.out.println("Found " + checkboxes.length);
//Go through them , and decide which one to select.
for(TestObject checkbox: checkboxes)
{
System.out.println("Checkbox Value: "+ checkbox.getProperty(".value"));
}
}
you can call the above method and pass it the parent DIV object.
About the second question:
You have not mentioed how does RFT recognize the one object for the tree ( means which proxy does it use as per the object map's adminitrative properties for that object).
Usually controls like tree /grid etc are recognized as one control and the items of these controls as "Subitem" which are found by specifying subitem as atPath("xyz->abc") etc.

Related

How to find all visible deeply nested ListView items?

Im working on a squish based test and try to get decent (visible) items from a QML ListView that are deeply nested that i just can't pick due to its dynamic behavior
I've get the list itself by using waitForObject with a object map name
There are several nested items in the list an i want to get all occurrences of the MyTypeCCC_QMLTYPE_72 when property visible is true
I've dumped my current class/property child-hierachy:
MyTypeAAA_QMLTYPE_195
children[0] QQuickItem
children[0] QQuickColumn
children[0] MyTypeBBB_QMLTYPE_189
children[0] MyTypeCCC_QMLTYPE_7 visible(true)
I've found this in the Squish-KB: https://kb.froglogic.com/display/KB/Example+-+Finding+child+objects+by+type+and+property+values
so i can write my own search code traversing the tree etc. but i think that could(should) be an easier solution?
can i rely on the exact hierarchy? (but what i the UI design changed another time)
i could maybe add ids to the MyTypeCCC_... if that helps
I've got several of this list with different types/nesting and i hope to find a easy solution that works for all/many of the case
any ideas?
ListView is a subclass of Flickable and all its delegates are immediate children of ContentItem, you can safely iterate over its children to get all list items, but be aware that not all of its children are list delegates, so you have to filter them, e.g. by type. To find nested elements just search for them inside list item, i.e. use list item as a container. To create container locator you can use its coordinates (these are coordinates within the list, so they will be unique). Code may look like this:
list_view = findObject(list_locator)
nested = []
for i in range(list_view.contentItem.children.count):
item = list_view.contentItem.children.at(i)
if className(item) == 'MyTypeAAA':
netsed.append(findObject({'container': {'x': item.x, 'y': item.y, 'type': className(item)}, 'type': 'MyTypeCCC'}))

RowFilter on JFace TreeViewer

I have a TreeViewer as shown here:
.
I have a text field to enter the percentage values. Suppose the percentage entered is 30 %, I should hide all the rows that are below 30% and display only the rows above 30%. Is there any row filter that I can use for my TreeViewer? It would be great if some examples are provided.
I am using e4 RCP. I want to do View based filtering and prefer not to change the Model.
You use a class which extends ViewFilter to filter the rows in a tree viewer.
The main method to override in the ViewFilter is the select method:
#Override
public boolean select(Viewer viewer, Object parentElement, Object element)
here you are given the object being considered (element) along with its parent and the viewer. You return true to keep displaying the element and false to hide it.
You can have several filters active if required, set them in the tree viewer using:
treeViewer.setFilters(array of view filters);
You may need to call
treeViewer.filter();
when something changes in the tree which requires the filters to be re-run.

How can I focus to a specific item which is in the bottom of the page in IDE

I am trying to select a specific item in a page which is at the bottom of the page. I want to verify that element is present and the same time I want to focus to that specific item.
How can I do this in the Selenium IDE?
I tried storeEval, but its specific co-ordinated which I don't want. I am looking for some dynamic command. I tried using css:.groupTile:contains("Concentrated") but the focus is not going to that particular item (Concentrated).
Can someone help me with Command, Target and value please?
CSS Selectors have many formats
i) Using id. Put this in Target: css=tag#id
tag = the HTML tag of the element being accessed,
id = the ID of the element being accessed
ii) Using class. Put this in Target: css=tag.class
tag = the HTML tag of the element being accessed,
class = the class of the element being accessed
In value you enter name of the item.

Sencha Touch 2: Insert into TreeStore/NestedList

I'm using a NestedList with a underlying TreeStore. Now I want to add items to the NestedList as leafs.
How can I do this?
Currently my code (Controller, onAddButtonTapped) looks like this:
var store = Ext.getStore('menuStore');
var customerAreaNode = store.getRoot().getChildAt(1);
customerAreaNode.appendChild({name: "text", leaf:true});
customerAreaNode.expand();
store.sync();
This code results in two new empty listentries on leaf level (behind the correct node) and one new listentry on node level.
Every new entry has no names shown in the NestedList but every item contains "text" in their name field. Curiously one of the new entries at leaf level is not typed to the underlying Model. So the model-corresponding methods could't be found:
Uncaught TypeError: Cannot call method 'getSelectedName' of undefined
Does anybody know a easy tutorial how to add data into NestedList/TreeStore? I could not find one good example in the sencha touch docs.
The default display field for leaf items is "text". You can get the information from here. If you want to use "text" as display field, then you need to change this line to
customerAreaNode.appendChild({text: "text", leaf:true});
Or you can change your nested list's display field, so your model do not need to change for this time.
yournestedlist.setDisplayField('name');
Hope this helps.
In my case i used to update root and child nodes like the following way
Ext.getStore('Contactsstore').getAt(1).getChildAt(0).set('Email',contactemail);
Ext.getStore('Contactsstore').getAt(1).set('ContactTitle',contacttitle);

Confusion using dijit.byId and dojo.byId

I am trying to understand the difference between
dijit.byId and dojo.byId
For this i have taken a Button and a div .(To set the
data inside the div on click of the Button)
Show Me!
<div id="findMe">
Hiya!
</div>
This is working (dojo.byId)
function callMe()
{
var node = dojo.byId('findMe');
node.innerHTML = "Hello World";
}
But this isn't working (dijit.byId)
function callMe()
{
var node = dijit.byId('findMe');
node.innerHTML = "Hello World";
}
My understanding is , when refering to the div we need to use dojo.byId
and when we are refering to Individual components use dijit.byId
Please correct me if i am wrong .
As previously stated, dojo.byId retrieves the DOM node with that id if existent.
dijit.byId retrieves the instance of a dijit._Widget (and its subclasses), that is dojo's abstraction of UI objects, rather than the widget's DOM node. But it is important to note that dijit.byId searches through the widgets by the atrribute "widgetId", not "id". These are equal if you declare your widgets by passing a container node that already has an "id", but still dojo creates an attribute "widgetId" for every widget if not specified explicitly.
This means that widgetId and id are usually the same, but it is possible that they are different. Plus, widgetId is always set for a given widget even in cases where the id attribute of the container node is absent.
This implies that you should use dojo.byId whenever you intend to work on the DOM tree itself and dijit.byId only in case where you'd like to obtain the instance of a certain widget instance. If no widgets are present, there is no reason to use dijit.byId at all.
You are right:
dojo.byId finds elements in the DOM tree of your website with a certain ID - it searches and returns HTML elements.
dijit.byId finds dijits you created with a certain id - it searches and returns dijits (javascript objects), although these objects usually refer to a certain DOM node.