Page 1 of 1

How to get the disabled tags based on the main tabletag

Posted: Thu Jul 30, 2015 5:42 am
by nandhu
Hi Ranorex,

Is there any way to get all the disabled tags present on the page based on the main TableTag of the page.
Let me give an example,
If we want all td's present on the page m using this code:

TableTag searchTable = (Ranorex.TableTag)objScrptVarBO.pageObj.PBGetElement(tableName);
foreach(Ranorex.TdTag tags in searchTable.FindDescendants<Ranorex.TdTag>())
{
if(dc.ColumnName == tags.InnerText)
Report.Log(ReportLevel.Info,tags.InnerText);
}

Like this way,Can we get all the disabled tags beased on the tabletag...?

Re: How to get the disabled tags based on the main tabletag

Posted: Thu Jul 30, 2015 9:01 am
by odklizec
Hi,

Could you please upload Ranorex snapshot of the table in question?

Re: How to get the disabled tags based on the main tabletag

Posted: Thu Jul 30, 2015 9:24 am
by nandhu
Spy.png
Here in the image I have added the table tag that is rounded.Based on this table tag i need to check the whole table where the disabled tags are present.
In this image select tag that i rounded is a disable tag u can see the iamge on right down side.
Aim is to get the disabled tags in that table what ever tag type it may be.

Re: How to get the disabled tags based on the main tabletag

Posted: Thu Jul 30, 2015 9:39 am
by odklizec
Hi,

Thanks for the screenshot, but what I asked for is Ranorex Snapshot! ;) Please learn how to create one here:
http://www.ranorex.com/support/user-gui ... files.html
Snapshot will help us to understand the structure of table and available attributes of elements.

Re: How to get the disabled tags based on the main tabletag

Posted: Thu Jul 30, 2015 10:22 am
by nandhu
Ofcurse i shuld hve send you bt its not possible.If we do based on the structure it differs when we use vth other pages i have to form a common function wat evrver the page it may be if diasabled tags are present it should throw the message containing disabled tags
In the above pic,
table xpath is:.//table
select tag path which i rounded is .//select[@id="lineOfBusinessId"]

Re: How to get the disabled tags based on the main tabletag

Posted: Thu Jul 30, 2015 11:50 am
by odklizec
OK, without the snapshot, I can only guess then xpath to find all disabled elements should look like this:

Code: Select all

table//*[@disabled='True']
I would suggest to add a new element with such xpath to repository. Then create new user code action with this code:
public void ListAllDisabledElements(Ranorex.Core.Repository.RepoItemInfo repoElement)
        {
        	//create IList of all elements, available to given repo element
			IList<Ranorex.Unknown> allElementsList = repoElement.CreateAdapters<Ranorex.Unknown>();
	
			//go through list of all elements and save obtained values to CSV connector file
			foreach (Ranorex.Unknown unknownTagElement in allElementsList)
			{  				
				//make sure the element is visible
				if(!unknownTagElement.Visible)
				{
					unknownTagElement.EnsureVisible();
				}
				//get preferred capability of selected element
				string prefCapability = unknownTagElement.Element.PreferredCapability.DisplayName;
				Report.Info("Disabled Element", "Preferred Capability: " + prefCapability);
			}
        }
This should list all disabled elements in table and list them in report (their preferred capability). Then you can do whatever you want with them. Of course, it should be possible to find all disabled elements also without using predefined repo item, e.g. via Find method (based of above mentioned xpath)?