How to get the disabled tags based on the main tabletag

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
nandhu
Posts: 12
Joined: Wed Jan 21, 2015 6:59 am

How to get the disabled tags based on the main tabletag

Post by nandhu » Thu Jul 30, 2015 5:42 am

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...?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

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

Post by odklizec » Thu Jul 30, 2015 9:01 am

Hi,

Could you please upload Ranorex snapshot of the table in question?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

nandhu
Posts: 12
Joined: Wed Jan 21, 2015 6:59 am

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

Post by nandhu » Thu Jul 30, 2015 9:24 am

Spy.png
Spy.png (48.14 KiB) Viewed 650 times
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.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

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

Post by odklizec » Thu Jul 30, 2015 9:39 am

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

nandhu
Posts: 12
Joined: Wed Jan 21, 2015 6:59 am

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

Post by nandhu » Thu Jul 30, 2015 10:22 am

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"]

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

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

Post by odklizec » Thu Jul 30, 2015 11:50 am

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)?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration