Find.ByExpression Code Migration to 2010 Version issue

5 posts, 0 answers
  1. Senthil
    Senthil  avatar
    12 posts
    Member since:
    Apr 2010

    Posted 25 Jan 2011 Link to this post

    I am trying to migrate my tests to the latest version Telerik WebUI Test Studio 2010.3

    The following code runs into an issue:
           Browser b = ActiveBrowser.Frames["DimTree"];
                   String[] _StringFind = { "All Areas", "By Areas" };
                   HtmlDiv _div = null;
                   for (int i = 0; i < _StringFind.Length; i++)
                   {
                       HtmlControl c = b.Find.ByExpression<HtmlControl>("InnerText=" + _StringFind[i]);
                       _div = b.Find.ByExpression<HtmlDiv>("InnerText=" + _StringFind[i]);

    The Find.ByExpression returns null...The earlier version returns data.

    Can some one help.
  2. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 26 Jan 2011 Link to this post

    Hello Senthil ,
        would please give me the HTML code for the two elements you want to get with these two expressions:
    b.Find.ByExpression<HtmlControl>("InnerText=" + _StringFind[i]);
    b.Find.ByExpression<HtmlDiv>("InnerText=" + _StringFind[i]);


    In fact if you could share the entire HTML code of the page containing these elements - that would be best.

    Hope to hear from you soon!

    Best wishes,
    Stoich
    the Telerik team
    Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
  3. Senthil
    Senthil  avatar
    12 posts
    Member since:
    Apr 2010

    Posted 26 Jan 2011 Link to this post

    <HTML><HEAD><TITLE> Report_Trending (University) - Cognos PowerPlay Web Explorer</TITLE><META content="text/html; charset=windows-1252" http-equiv=Content-Type><SCRIPT type=text/javascript>var topparent = parent;</SCRIPT><SCRIPT type=text/javascript src="../ppwb/action.js"></SCRIPT><SCRIPT type=text/javascript src="../ppwb/dimTree.js"></SCRIPT><SCRIPT type=text/javascript src="../ppwb/commands.js"></SCRIPT><SCRIPT type=text/javascript src="../ppwb/ContextMenu.js"></SCRIPT><SCRIPT type=text/javascript src="../ppwb/dndManager.js"></SCRIPT><SCRIPT type=text/javascript src="../ppwb/event.js"></SCRIPT><SCRIPT type=text/javascript src="../ppwb/context.js"></SCRIPT><SCRIPT type=text/javascript src="../ppwb/dimtreecommands.js"></SCRIPT><SCRIPT type=text/javascript src="../ppwb/base.js"></SCRIPT><SCRIPT type=text/javascript src="../ppwb/msgutil.js"></SCRIPT><SCRIPT type=text/javascript src="../ppwb/encodingutil.js"></SCRIPT><SCRIPT type=text/javascript src="../ppwb/dimcache.js"></SCRIPT><LINK title="PPWEB Styles" rel=stylesheet type=text/css href="../ppwb/styles.css"><LINK title="PPWEB Language Specific Styles" rel=stylesheet type=text/css href="../ppwb/styles_en.css"><SCRIPT type=text/javascript>var dTree;
                                      
                    var dim_ContextMenu = new Array();
                  
                      
                        dim_ContextMenu['replace_rows'] = new contextmenuOption(CEncodingUtil.ForceUnescape('Replace Rows'), '1');  
                      
                        dim_ContextMenu['replace_cols'] = new contextmenuOption(CEncodingUtil.ForceUnescape('Replace Columns'), '1');   
                      
                        dim_ContextMenu['nest_rows'] = new contextmenuOption(CEncodingUtil.ForceUnescape('Nest Rows'), '1');    
                      
                        dim_ContextMenu['nest_cols'] = new contextmenuOption(CEncodingUtil.ForceUnescape('Nest Columns'), '1'); 
                      
                        dim_ContextMenu['filter'] = new contextmenuOption(CEncodingUtil.ForceUnescape('Filter'), '1');  
                      
                        dim_ContextMenu['find'] = new contextmenuOption(CEncodingUtil.ForceUnescape('Find...'), '1');   
                      
                        dim_ContextMenu['hide_tree'] = new contextmenuOption(CEncodingUtil.ForceUnescape('Hide Tree'), '1');    
                      
                        dim_ContextMenu['hide_tree_toolbar'] = new contextmenuOption(CEncodingUtil.ForceUnescape('Hide Toolbar'), '1'); 
                      
                        dim_ContextMenu['show_tree_toolbar'] = new contextmenuOption(CEncodingUtil.ForceUnescape('Show Toolbar'), '1'); 
                      
                        dim_ContextMenu['delete_subset'] = new contextmenuOption(CEncodingUtil.ForceUnescape('Delete'), '1');   
                      
                        dim_ContextMenu['rename_subset'] = new contextmenuOption(CEncodingUtil.ForceUnescape('Rename...'), '1');    
                      
                        dim_ContextMenu['edit_subset'] = new contextmenuOption(CEncodingUtil.ForceUnescape('Edit...'), '1');    
                      
                        dim_ContextMenu['duplicate_subset'] = new contextmenuOption(CEncodingUtil.ForceUnescape('Duplicate'), '1'); 
                      
                      
                    topparent.setGlobal("virtualDirRoot", CEncodingUtil.ForceUnescape('/cognos'));  
                    topparent.setGlobal("language_css","styles_en.css");
                      
                    topparent.setGlobal("mainFormURL", CEncodingUtil.ForceUnescape('/cognos/cgi-bin/ppdsisapi.dll'));
                    topparent.setGlobal("mainFormMethod", 'POST');
      
                    var cubeName = CEncodingUtil.ForceUnescape("Trending)");
                    topparent.setGlobal("childLimit",200);
                      
          
     
        dimCache.addDimension("TUVBU1VSRVN=",CEncodingUtil.ForceUnescape("MEASURES"),CEncodingUtil.ForceUnescape("MEASURES"),"4","" );</SCRIPT></HEAD><BODY oncontextmenu=contextMenu(event); class=dimTree onkeypress=topparent.getXtabFrame().keyPressed(event); onmousedown=preventNetscapeDrag(event); onclick="if ( event['altKey'] ) contextMenu(event); else {topparent.executeCrossFrameFunction ( 'hidePopupMenu', '', true);clearDrag(event);deselectAll();}" onunload="topparent.deregisterFrame( window.name );" onload=topparent.registerFrameLoaded(window.name); type="tb"><IFRAME style="WIDTH: 105px; HEIGHT: 120px; VISIBILITY: visible; OVERFLOW: auto; TOP: 72px; LEFT: 86px" id=WebFX_ContextPopUp class=WebFX-ContextMenu marginHeight=0 src="../ppwb/blank.html" frameBorder=0 name=DimTreeContextMenu marginWidth=0 scrolling=no></IFRAME><DIV id=dimTreeContainer class=dimtree_content_div><DIV style="HEIGHT: 0px" class=dimtree_item_div expand="1" topNode="true"><SPAN jointType="1"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/Lminus.png" theSrc="http://scr.com/cognos/ppwb/Icon/Lminus.png"></SPAN><SPAN iconType="2" enabled="true"><IMG style="VISIBILITY: visible" class=dimtree_folder_icon src="http://scr.com/cognos/ppwb/Icon/openfoldericon.png" theSrc="http://scr.com/cognos/ppwb/Icon/openfoldericon.png"></SPAN><A class=dimtree_text href="#">Trending)</A></DIV><DIV style="HEIGHT: 0px" class=dimtree_content_div prevCode="0" subtree="2"><DIV style="HEIGHT: 0px" class=dimtree_item_div type="cm" code="RXZlbnQgRGF0ZXN=" ppdsId="315" dimIdx="0" level="1" expand="2" page="0" isHierRoot="false" customSubset="false" measurePlaceholder="false" tndisabled="false" selectable="true"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/blank.png" theSrc="http://scr.com/cognos/ppwb/Icon/blank.png"><SPAN jointType="0"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/Tplus.png" theSrc="http://scr.com/cognos/ppwb/Icon/Tplus.png"></SPAN><SPAN iconType="2" enabled="true"><IMG style="VISIBILITY: visible" class=dimtree_folder_icon src="http://scr.com/cognos/ppwb/Icon/foldericon.png" theSrc="http://scr.com/cognos/ppwb/Icon/foldericon.png"></SPAN><A class=dimtree_text href="#">All Event Dates</A></DIV><DIV style="HEIGHT: 0px" class=dimtree_content_div_hidden prevCode="01" subtree="0"></DIV><DIV style="HEIGHT: 0px" class=dimtree_item_div type="cm" code="RXZlbnRUeXBlc0tleU==" ppdsId="363" dimIdx="1" level="1" expand="2" page="0" isHierRoot="false" customSubset="false" measurePlaceholder="false" tndisabled="false" selectable="true"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/blank.png" theSrc="http://scr.com/cognos/ppwb/Icon/blank.png"><SPAN jointType="0"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/Tplus.png" theSrc="http://scr.com/cognos/ppwb/Icon/Tplus.png"></SPAN><SPAN iconType="2" enabled="true"><IMG style="VISIBILITY: visible" class=dimtree_folder_icon src="http://scr.com/cognos/ppwb/Icon/foldericon.png" theSrc="http://scr.com/cognos/ppwb/Icon/foldericon.png"></SPAN><A class=dimtree_text href="#">All Event Types</A></DIV><DIV style="HEIGHT: 0px" class=dimtree_content_div_hidden prevCode="01" subtree="0"></DIV><DIV style="HEIGHT: 0px" class=dimtree_item_div type="cm" code="SGFybVNjb3JlVHlwZUtleU==" ppdsId="419" dimIdx="2" level="1" expand="2" page="0" isHierRoot="false" customSubset="false" measurePlaceholder="false" tndisabled="false" selectable="true"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/blank.png" theSrc="http://scr.com/cognos/ppwb/Icon/blank.png"><SPAN jointType="0"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/Tplus.png" theSrc="http://scr.com/cognos/ppwb/Icon/Tplus.png"></SPAN><SPAN iconType="2" enabled="true"><IMG style="VISIBILITY: visible" class=dimtree_folder_icon src="http://scr.com/cognos/ppwb/Icon/foldericon.png" theSrc="http://scr.com/cognos/ppwb/Icon/foldericon.png"></SPAN><A class=dimtree_text href="#">All Harm Scores</A></DIV><DIV style="HEIGHT: 0px" class=dimtree_content_div_hidden prevCode="01" subtree="0"></DIV><DIV style="HEIGHT: 0px" class=dimtree_item_div type="cm" code="Q2FyZSBBcmVhIFR5cGV=" ppdsId="467" dimIdx="3" level="1" expand="1" page="0" isHierRoot="false" customSubset="false" measurePlaceholder="false" tndisabled="false" selectable="true"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/blank.png" theSrc="http://scr.com/cognos/ppwb/Icon/blank.png"><SPAN jointType="0"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/Tminus.png" theSrc="http://scr.com/cognos/ppwb/Icon/Tplus.png"></SPAN><SPAN iconType="2" enabled="true"><IMG style="VISIBILITY: visible" class=dimtree_folder_icon src="http://scr.com/cognos/ppwb/Icon/openfoldericon.png" theSrc="http://scr.com/cognos/ppwb/Icon/foldericon.png"></SPAN><A class="dimtree_text dimtree_text_rollover" href="#">All Areas</A></DIV><DIV style="HEIGHT: 0px" class=dimtree_content_div prevCode="01" subtree="2"><DIV style="HEIGHT: 0px" class=dimtree_item_div type="cm" code="QnkgQ2FyZUFyZWFLZXl=" ppdsId="495" dimIdx="3" level="1" expand="2" page="0" isHierRoot="false" customSubset="false" measurePlaceholder="false" tndisabled="false" selectable="true"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/blank.png" theSrc="http://scr.com/cognos/ppwb/Icon/blank.png"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/I.png" theSrc="http://scr.com/cognos/ppwb/Icon/I.png"><SPAN jointType="0"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/Tplus.png" theSrc="http://scr.com/cognos/ppwb/Icon/Tplus.png"></SPAN><SPAN iconType="2" enabled="true"><IMG style="VISIBILITY: visible" class=dimtree_folder_icon src="http://scr.com/cognos/ppwb/Icon/foldericon.png" theSrc="http://scr.com/cognos/ppwb/Icon/foldericon.png"></SPAN><A class=dimtree_text href="#">By Care Area Types</A></DIV><DIV style="HEIGHT: 0px" class=dimtree_content_div_hidden prevCode="011" subtree="0"></DIV><DIV style="HEIGHT: 0px" class=dimtree_item_div type="cm" code="QnkgQ2FyZSBBcmVhc2==" ppdsId="709" dimIdx="3" level="1" expand="2" page="0" isHierRoot="true" customSubset="false" measurePlaceholder="false" tndisabled="false" selectable="true"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/blank.png" theSrc="http://scr.com/cognos/ppwb/Icon/blank.png"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/I.png" theSrc="http://scr.com/cognos/ppwb/Icon/I.png"><SPAN jointType="1"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/Lplus.png" theSrc="http://scr.com/cognos/ppwb/Icon/Lplus.png"></SPAN><SPAN iconType="3" enabled="true"><IMG style="VISIBILITY: visible" class=dimtree_folder_icon src="http://scr.com/cognos/ppwb/Icon/alternate_drill.png" theSrc="http://scr.com/cognos/ppwb/Icon/alternate_drill.png"></SPAN><A class=dimtree_text href="#">By Areas</A></DIV><DIV style="HEIGHT: 0px" class=dimtree_content_div_hidden prevCode="010" subtree="0"></DIV></DIV><DIV style="HEIGHT: 0px" class=dimtree_item_div type="cm" code="UmVwb3J0U3RhdHVzS2V5" ppdsId="537" dimIdx="4" level="1" expand="2" page="0" isHierRoot="false" customSubset="false" measurePlaceholder="false" tndisabled="false" selectable="true"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/blank.png" theSrc="http://scr.com/cognos/ppwb/Icon/blank.png"><SPAN jointType="0"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/Tplus.png" theSrc="http://scr.com/cognos/ppwb/Icon/Tplus.png"></SPAN><SPAN iconType="2" enabled="true"><IMG style="VISIBILITY: visible" class=dimtree_folder_icon src="http://scr.com/cognos/ppwb/Icon/foldericon.png" theSrc="http://scr.com/cognos/ppwb/Icon/foldericon.png"></SPAN><A class=dimtree_text href="#">Report Status (Both)</A></DIV><DIV style="HEIGHT: 0px" class=dimtree_content_div_hidden prevCode="01" subtree="0"></DIV><DIV style="HEIGHT: 0px" class=dimtree_item_div type="cm" code="UFNPU3RhdHVzS2V5" ppdsId="731" dimIdx="5" level="1" expand="2" page="0" isHierRoot="false" customSubset="false" measurePlaceholder="false" tndisabled="false" selectable="true"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/blank.png" theSrc="http://scr.com/cognos/ppwb/Icon/blank.png"><SPAN jointType="0"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/Tplus.png" theSrc="http://scr.com/cognos/ppwb/Icon/Tplus.png"></SPAN><SPAN iconType="2" enabled="true"><IMG style="VISIBILITY: visible" class=dimtree_folder_icon src="http://scr.com/cognos/ppwb/Icon/foldericon.png" theSrc="http://scr.com/cognos/ppwb/Icon/foldericon.png"></SPAN><A class=dimtree_text href="#">PSI Status (Both)</A></DIV><DIV style="HEIGHT: 0px" class=dimtree_content_div_hidden prevCode="01" subtree="0"></DIV><DIV style="HEIGHT: 0px" class=dimtree_item_div type="cm" code="QWdlR3JvdXBLZXl=" ppdsId="619" dimIdx="6" level="1" expand="2" page="0" isHierRoot="false" customSubset="false" measurePlaceholder="false" tndisabled="false" selectable="true"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/blank.png" theSrc="http://scr.com/cognos/ppwb/Icon/blank.png"><SPAN jointType="0"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/Tplus.png" theSrc="http://scr.com/cognos/ppwb/Icon/Tplus.png"></SPAN><SPAN iconType="2" enabled="true"><IMG style="VISIBILITY: visible" class=dimtree_folder_icon src="http://scr.com/cognos/ppwb/Icon/foldericon.png" theSrc="http://scr.com/cognos/ppwb/Icon/foldericon.png"></SPAN><A class=dimtree_text href="#">All Age Groups</A></DIV><DIV style="HEIGHT: 0px" class=dimtree_content_div_hidden prevCode="01" subtree="0"></DIV><DIV style="HEIGHT: 0px" class=dimtree_item_div type="cm" code="SW5PdXRQYXRpZW50" ppdsId="641" dimIdx="7" level="1" expand="2" page="0" isHierRoot="false" customSubset="false" measurePlaceholder="false" tndisabled="false" selectable="true"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/blank.png" theSrc="http://scr.com/cognos/ppwb/Icon/blank.png"><SPAN jointType="0"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/Tplus.png" theSrc="http://scr.com/cognos/ppwb/Icon/Tplus.png"></SPAN><SPAN iconType="2" enabled="true"><IMG style="VISIBILITY: visible" class=dimtree_folder_icon src="http://scr.com/cognos/ppwb/Icon/foldericon.png" theSrc="http://scr.com/cognos/ppwb/Icon/foldericon.png"></SPAN><A class=dimtree_text href="#">In and Out Patients</A></DIV><DIV style="HEIGHT: 0px" class=dimtree_content_div_hidden prevCode="01" subtree="0"></DIV><DIV style="HEIGHT: 0px" class=dimtree_item_div type="cm" code="U2hpZnRLZXl=" ppdsId="689" dimIdx="8" level="1" expand="2" page="0" isHierRoot="false" customSubset="false" measurePlaceholder="false" tndisabled="false" selectable="true"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/blank.png" theSrc="http://scr.com/cognos/ppwb/Icon/blank.png"><SPAN jointType="0"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/Tplus.png" theSrc="http://scr.com/cognos/ppwb/Icon/Tplus.png"></SPAN><SPAN iconType="2" enabled="true"><IMG style="VISIBILITY: visible" class=dimtree_folder_icon src="http://dev-powerplay. /Icon/foldericon.png" theSrc="http://scr.com/cognos/ppwb/Icon/foldericon.png"></SPAN><A class=dimtree_text href="#">Shifts</A></DIV><DIV style="HEIGHT: 0px" class=dimtree_content_div_hidden prevCode="01" subtree="0"></DIV><DIV style="HEIGHT: 0px" class=dimtree_item_div type="cm" code="TUVBU1VSRVN=" ppdsId="4" dimIdx="9" level="1" expand="2" page="0" isHierRoot="false" customSubset="false" measurePlaceholder="false" tndisabled="false" selectable="true"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/blank.png" theSrc="http://scr.com/cognos/ppwb/Icon/blank.png"><SPAN jointType="1"><IMG style="VISIBILITY: visible" class=dimtree_icon src="http://scr.com/cognos/ppwb/Icon/Lplus.png" theSrc="http://scr.com/cognos/ppwb/Icon/Lplus.png"></SPAN><SPAN iconType="2" enabled="true"><IMG style="VISIBILITY: visible" class=dimtree_folder_icon src="http://scr.com/cognos/ppwb/Icon/foldericon.png" theSrc="http://scr.com/cognos/ppwb/Icon/foldericon.png"></SPAN><A class=dimtree_text href="#">MEASURES</A></DIV><DIV style="HEIGHT: 0px" class=dimtree_content_div_hidden prevCode="00" subtree="0"></DIV></DIV></DIV></BODY></HTML>
  4. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 27 Jan 2011 Link to this post

    Hello Senthil ,

    I believe we just resolved this one in our GoToMeeting.

    Kind regards,
    Cody
    the Telerik team
    Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
  5. Senthil
    Senthil  avatar
    12 posts
    Member since:
    Apr 2010

    Posted 27 Jan 2011 Link to this post

    The single line of code that did the trick was b.RefreshDomTree(). Thanks to Cody who helped me out with this. As he mentioned, for performance purposes there is a copy of cache maintained and it turns stale. RefreshDomTree gets the latest one and hence the results come...


                     Browser b = ActiveBrowser.Frames["DimTree"] ;
                     String[] _StringFind = { "All Areas", "By Areas" };
                   
                   HtmlDiv _div = null;
                  
                   for (int i = 0; i < _StringFind.Length; i++)
                   {
                       //original
                       b.RefreshDomTree();
                       HtmlControl c = b.Find.ByExpression<HtmlControl>("InnerText=" + _StringFind[i]);
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!