Forum Discussion

Bharadwaj's avatar
Bharadwaj
Contributor
14 years ago

Cant access checkbox in Developer express grid column in the browser

Hi, I am trying to access the checkbox embedded in one of the columns of the developer express grid. (Please refer to the attachments) . The following is the configuration of browser and test complete I am currently using:


Browser: IE8 64-bit (we want to test on IE8, so cant upgrades the browser)


TestComplete : 8.70.727.7


OS: Windows 7 professional 64 bit


The current problem which I have is the individual columns of the grid in which the checkboxes are placed can only be referred in test complete as cells with child count zero and if we go through the properties of cell in object spy of test complete (please refer to attachments),we don’t have any property except the innerHtml or OuterHtml of the cell which actually depicts that the cell has checkbox embedded in it. The innerHtml property of the cell (with checkbox ticked) looks like this:


<SPAN class="dxWeb_edtCheckBoxChecked dxICheckBox"></SPAN>


 And for unchecked checkbox the innerHtml looks like this:


<SPAN class="dxWeb_edtCheckBoxUnChecked dxICheckBox"></SPAN>


 


So presently my script is actually accessing the InnerHtml property of the cell object and parsing the sub string edtCheckBoxChecked or edtCheckBoxUnChecked in the <span….> tag and then determining whether the checkbox is either checked or unchecked.


The problem with this approach is that every time if developer express changes their class from class="dxWeb_edtCheckBoxChecked dxICheckBox" to let’s say class="dxWeb_xxxxxxx" ,we have to modify our code according to the name change in the span tag. This approach is increasing our reliability on devx naming and we are asked not to rely on this by devx as there will be changes in its styling in every release of devx patches. So is there any better approach for this problem.


 


 


 


 


 

2 Replies

  • Bharadwaj,


    As far as I can see, your application is using a DevExpress ASPxGrdiView control. DX doesn't use check boxes in cells; the check boxes are drawn depending on the class of the internal SPAN element.


    In this case, your current solution (checking the class name) seems most reasonable for me. I'd suggest using it and changing your tests when DX changes the grid control. You can create a list of acceptable classes and in your function that checks the class name, verify the class against several values.


    I created a small sample app on my computer to investigate the situation. I checked the SPAN.currentStyle.backgroundImage property to see if it depends on the class name. Unfortunately, DX uses the same image - url(/DXR.axd?r=1_29-dB_U4) - for both selected and clean check boxes, so the image name does not help. They use different SPAN.currentStyle.backgroundPositionX property values: -56px for checked boxes, and -41px for unchecked boxes. However, I would not recommend using this property for the check as they can change it along with the class name.


    One possible alternative is to obtain the image of the needed cell with the Picture method and then search for the checked or unchecked box within this image. However, searching the images will take more time than checking the class names. So, again, I'd consider checking the class name...


    >> This approach is increasing our reliability on devx naming and we are asked not to rely on this by devx as there will be changes in its styling in every release of devx patches.  <<

    Interesting answer. :-) Did they recommend another approach?

  • Hi Alex,



    Thanks for your  reply.Yes as far as I see i think the way you have suggested looks like the only solution for the time being.