Monday, September 19, 2011

Challenges faced in ext js

Hi,
I.m working on ext js application, whose speciality is,all the elements of the page are dynamic.This indicates that its not automation friendly.
I'll post some of the locators which i used to locate elements.


Selecting from drop down
There is a select list, which contains a text box and down arrow image button, clicking on button image, opens a drop down which contains element with dynamic id's.
Dynamic elements are : drop down elements (div's) , and image button.
 Clue is, input box has an id.

This can be located as.

//input[@id='abc']/following-sibling::img

this clicks on image .now we need to select the dropdown list element , which also has dynamic id.
So,i used text function as,

//div[text()='CPA']

which clicks on cpa in the dropdown list.

Locating elements with same name ,based on their position using css

I hadto locate 3 elements with same id.(Accounts). All had same name, no other unique identifier.

So,i could locate them using,

css=div#salestabs  td[class*=Accounts ]
css=div#salestabs  td[class*=Accounts ]  div:nth(1)
css=div#salestabs  td[class*=Accounts ]  div:nth(2)


Css will locate element based on their parent element.The above css looks so simple, but the dom is so complex.

div has class name x-combo-list-inner,under that


<div class="x-combo-list-item">YYYY-Month</div>
<div class="x-combo-list-item  x-combo-selected">YYYY-MM</div>
<div class="x-combo-list-item  x-combo-selected">MM-YYYY</div>

and then div closes(</div>)

Another div having same class name and same list of combo items as mentioned above. is located below the above div.

 <div class='x-combo-list-inne'>
<div class="x-combo-list-item">YYYY-Month</div>
<div class="x-combo-list-item  x-combo-selected">YYYY-MM</div>
<div class="x-combo-list-item  x-combo-selected">MM-YYYY</div>
 </div>

this can be located as

css=div[class*='x-combo-list-inner'] div:nth(2)---locates  3rd element of 1st div.

css=div[class*='x-combo-list-inner'] div:nth(5)--locates 3rd element of 2nd div.


Post will be continued as n wen i find more challenges.....

















No comments:

Post a Comment