Forum Discussion

shafay's avatar
shafay
Occasional Contributor
7 years ago

The window size is (0, 0)

I am new to the testcomplete environment and having some basic issues which I cant find on the internet or on the smartbear website.

If Can you please help me with some of my queries it will be great.

 

To describe the problem: I have two dropdowns on my page with no ID. It works fine normally but when I do a test run from TestComplete what it does is create a panel and note the cursor position on that panel with x and y axis. Now this panel gives me ambiguous error which I handled through script but if it cant get the control how m I goin to work data driven test through an excel sheet also is there any other way to solve this issue?

 

Regards,

M.Shafay Shiraz

  • Hi there.

     

    I also work with DevX and have found that there are some major differences you need to work around.  Here's some things I have found so far.  A combobox is actually a panel->table->cells->textbox in.  Depending on how many buttons you have in your combobox, you may have more cells, but generally the second cell(0,1) has a textbox in with cell(0,2) being the down arrow.  I have a script for each DevX control type e.g. ASPxCombobox, ASPxGrid etc with methods that take the mapped object as parameter along with say the text you want to type.  These can then be dragged straight into a KWT.   I map the Table from Object browser and use WaitXXX and FindAllChildren methods with objecttype = textbox to get the textbox. This sorts the vast majority of cases.  Your additional info seems to indicate you are clicking the outer panel rather than the textbox inside the table. You have to type stuff into this textbox.  Also, use Keys() rather than SetText().  DevX does it's work on KeyUp, so SetText won't get the dropdown to show, update the combobox values etc.  My script looks like so (copy paste and edit on the go, so may have some syntax errors):

     

    		var waitObject = comboBoxObj.WaitCell(0,1,5000)  //Check that the combo box is ready
    		
    		if(!waitObject.Exists)
    		{
    			Log.Error("ASPxComboBox is not ready","",pmNormal,"",GetPagePicture());
    			return;
    		}
    		
    //now find the cell with the textbox in
    var cellprops = ["ObjectType","RowIndex","Visible"] //exclude ones that aren't visible.  Comboboxes have a cell(0,0) with nothing in
    		var cellvalues = ["Cell",0,true];	
    		var cellItems = comboBoxObj.FindAllChildren(cellprops,cellvalues,2).toArray();
    		if(cellItems.length==0)
    		{
    				Log.Error("Unable to find cell elements of Combobox table in the allocated time.","",pmNormal,"",GetPagePicture());	
    				return false;
    		}
    
    		
    		for(i=cellItems.length-1;i>=0;i--)
    		{
    				if(comboboxTextObj==null || comboboxTextObj==undefined)
    				{
    					comboboxTextObj = cellItems[i].FindChildEx("ObjectType","TextBox",1);					
    				}	
    				cellCollection.push([cellItems[i],cellItems[i].Enabled]);
    		}	
    		//Now make sure the Texbox is ready
    		comboboxTextObj.WaitProperty('Exists', true, 10000);
    		if(!comboboxTextObj.Exists)
    		{
    				Log.Error("Could not find Text element of ASPxComboBox","",pmNormal,"",GetPagePicture());
    				return false;
    		} 
    //yay, you have a textbox to type in
    comboboxTextObj.Click(); //no need for x,y coordinates, you can just click the textbox.  TC will click the middle
    comboboxTextObj.Keys("^a");
    comboboxTextObj.Keys("[BS]");
    comboboxTextObj.Keys(textValue);
    comboboxTextObj.Keys("[Tab]"); //DevX only "selects" an item from the list if the textbox loses focus by either clicking an item, pressing the down arrow ( comboboxTextObj.Keys("[Down]"); ) or tabbing out.
    return true; 

     

     

    Also, DevX has loads of Ajax, so the page might look ready but the controls arent.  You may have to add delays (yes, they make me cry) , use RefreshMappingInfo() or even both when you encounter these issues

     

    Further, if the loading panel is on screen, TC can click on a textbox, but not type because it will get an object not available for input, as it is disabled.  You need to wait for the loading panel to disappear before you start doing any work after a page load/postback on any pages that have the loading panel on.

     

    As tristaanogre can attest from one of my recent threads, this is a messy process.  If you read through this thread, you will find a function and some notes on how to test that the loading panel is gone, which you can call each time you try and set text.  It adds a small bit of overhead each time you set text, but is faster than a Delay which needs to cover any amount of load delay.  You could even parameterise your combobox script to take a boolean value to suppress the wait function if you know it won't show.  https://community.smartbear.com/t5/TestComplete-Functional-Web/Best-way-to-test-that-something-doesn-t-exist-without-an-error/m-p/174126#M33525 

     

    Did I say it's messy ?

     

     

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The ambiguous recognition is probably where you should start.  That is an indication that the criteria that you have in your NameMapping for that component (you can find out WHICH component in the Additional Info on that warning) is returning more than one result.  You need to work with your namemapping to narrow down your criteria to find the specific object.  Most likely, because of the ambiguous recognition, the component you need to click on for the rest of your test is not getting selected.  Because of that, whatever object you're expecting is not being resolved by your web page to be "visible" with a non-zero height and width.

     

    Start there and see where that fixes things.

    • shafay's avatar
      shafay
      Occasional Contributor

      thanks for replying, ok so i get it that my dropdown control is not being recognized by testcomplete because the dropdown does not have an ID. can you please elaborate the solution for it. also i have to work with datadriven testing here how is that going to be possible if all testcomplete is getting is x and y axis .. i mean for eg: its creating a click(58,14); as for datadruven testing i need a clickItem(MyValue); is there a way to resolve both my issues ?

    • shafay's avatar
      shafay
      Occasional Contributor

      one more thing i would like to add here that we are using angular JS and Devx here if that is of any concern.

      also the dropdown has no id and no name defined in HTML. it works fine but gives the reported error during the testrun

      • RUDOLF_BOTHMA's avatar
        RUDOLF_BOTHMA
        Community Hero

        Hi there.

         

        I also work with DevX and have found that there are some major differences you need to work around.  Here's some things I have found so far.  A combobox is actually a panel->table->cells->textbox in.  Depending on how many buttons you have in your combobox, you may have more cells, but generally the second cell(0,1) has a textbox in with cell(0,2) being the down arrow.  I have a script for each DevX control type e.g. ASPxCombobox, ASPxGrid etc with methods that take the mapped object as parameter along with say the text you want to type.  These can then be dragged straight into a KWT.   I map the Table from Object browser and use WaitXXX and FindAllChildren methods with objecttype = textbox to get the textbox. This sorts the vast majority of cases.  Your additional info seems to indicate you are clicking the outer panel rather than the textbox inside the table. You have to type stuff into this textbox.  Also, use Keys() rather than SetText().  DevX does it's work on KeyUp, so SetText won't get the dropdown to show, update the combobox values etc.  My script looks like so (copy paste and edit on the go, so may have some syntax errors):

         

        		var waitObject = comboBoxObj.WaitCell(0,1,5000)  //Check that the combo box is ready
        		
        		if(!waitObject.Exists)
        		{
        			Log.Error("ASPxComboBox is not ready","",pmNormal,"",GetPagePicture());
        			return;
        		}
        		
        //now find the cell with the textbox in
        var cellprops = ["ObjectType","RowIndex","Visible"] //exclude ones that aren't visible.  Comboboxes have a cell(0,0) with nothing in
        		var cellvalues = ["Cell",0,true];	
        		var cellItems = comboBoxObj.FindAllChildren(cellprops,cellvalues,2).toArray();
        		if(cellItems.length==0)
        		{
        				Log.Error("Unable to find cell elements of Combobox table in the allocated time.","",pmNormal,"",GetPagePicture());	
        				return false;
        		}
        
        		
        		for(i=cellItems.length-1;i>=0;i--)
        		{
        				if(comboboxTextObj==null || comboboxTextObj==undefined)
        				{
        					comboboxTextObj = cellItems[i].FindChildEx("ObjectType","TextBox",1);					
        				}	
        				cellCollection.push([cellItems[i],cellItems[i].Enabled]);
        		}	
        		//Now make sure the Texbox is ready
        		comboboxTextObj.WaitProperty('Exists', true, 10000);
        		if(!comboboxTextObj.Exists)
        		{
        				Log.Error("Could not find Text element of ASPxComboBox","",pmNormal,"",GetPagePicture());
        				return false;
        		} 
        //yay, you have a textbox to type in
        comboboxTextObj.Click(); //no need for x,y coordinates, you can just click the textbox.  TC will click the middle
        comboboxTextObj.Keys("^a");
        comboboxTextObj.Keys("[BS]");
        comboboxTextObj.Keys(textValue);
        comboboxTextObj.Keys("[Tab]"); //DevX only "selects" an item from the list if the textbox loses focus by either clicking an item, pressing the down arrow ( comboboxTextObj.Keys("[Down]"); ) or tabbing out.
        return true; 

         

         

        Also, DevX has loads of Ajax, so the page might look ready but the controls arent.  You may have to add delays (yes, they make me cry) , use RefreshMappingInfo() or even both when you encounter these issues

         

        Further, if the loading panel is on screen, TC can click on a textbox, but not type because it will get an object not available for input, as it is disabled.  You need to wait for the loading panel to disappear before you start doing any work after a page load/postback on any pages that have the loading panel on.

         

        As tristaanogre can attest from one of my recent threads, this is a messy process.  If you read through this thread, you will find a function and some notes on how to test that the loading panel is gone, which you can call each time you try and set text.  It adds a small bit of overhead each time you set text, but is faster than a Delay which needs to cover any amount of load delay.  You could even parameterise your combobox script to take a boolean value to suppress the wait function if you know it won't show.  https://community.smartbear.com/t5/TestComplete-Functional-Web/Best-way-to-test-that-something-doesn-t-exist-without-an-error/m-p/174126#M33525 

         

        Did I say it's messy ?