We developed a custom add-in for QTP to automate an Extjs application. Recently we came to know that the approach we took to develop the add-in is unreliable. We used the CSS classes displayed in the DOM tree to help QTP identify each object in the ExtJS application. Recently our developer told us that this way of relying on CSS classes is a problem as these CSS classes keep changing. For Ex: In the ExtJS web application, the Login button control's DOM looks like this in the Browser(just an outline, not exactly like below)
<a class = x-btn x-box-item x-btn-default-small id=button-1086 unselectable = on style = margin>
<span class = x-something>
<span class = y-something>Login</span>
So, in the toolkit config xml for the custom addin, we wrote the identification for button like this
<Conditions type="IdentifyIfPropMatch">
<Condition prop_name="classname" expected_value="x-btn" is_reg_exp="true" />
We use Javascript to extract the label Login present in the span tag above and assign it to the title property of our custom Extjsbutton control. So when I record using QTP, the VBScript code generated is
Browser("..").Page("..").Extjsbutton("Login").Click
In a recent release of the application, the button class name changed from x-btn to x-fastbutton in the DOM. With that QTP is not able to identify the button object.
We asked the application developer to give us some new attributes for each control in the application which are constant so that QTP can use them to identify each object in the application. The app developer gave us three new attributes and the new attributes look like this
<a id = 'button-123', class = 'x-button' , uft-xtype = Button, uft-isComponent = true,
uft-extclass = Ext.button.Button>
My question is , can we use these new attributes and their values directly in the Condition element in the toolkit config xml like
<Conditions type="IdentifyIfPropMatch">
<Condition prop_name="uft-xtype" expected_value="button" is_reg_exp="true" />
Or Should I use only those attributes which are registered in the native DOM like html id, classname,tagname, in the toolkit config xml's Condition element.
One of our add-in developer used an external functional call like the one below in the tool kit config xml to demonstrate the use of those new attributes given by the app developer.
<Identification function="isExtjsButton">
But I came to know from the QTP help file that using external function calls like this in the toolkit config xml would affect the performance of the add-in and should be avoided. I asked the developer to check if those custom attributes be used directly in the condition element and avoid making an external function call. But we could not crack it. An help on how to do this would be appreciated
Regards
Srinivas