check if an item has an accesible name

Ask general questions here.
mander95
Posts: 58
Joined: Tue Jun 21, 2016 7:35 pm

check if an item has an accesible name

Post by mander95 » Wed Jul 13, 2016 3:46 pm

given a repository item, is it possible to check if a it has an accessible name because I'm trying to create an exception in case the repository item doesn't have an accessible name?

User avatar
N612
Posts: 135
Joined: Mon Jul 11, 2016 4:01 pm

Re: check if an item has an accesible name

Post by N612 » Wed Jul 13, 2016 5:31 pm

With the limited information you provided, I can only assume you are trying to do this in a user code module.

You can return a repo item's attribute like this:

Code: Select all

repoItem.Element.GetAttributeValue("accessiblename")
Unfortunately being a new user I cannot link you directly to the API documentation, but you can search for more information on GetAttributeValue in Ranorex's API Documentation located in Ranorex Studio > Help menu > API Documentation

mander95
Posts: 58
Joined: Tue Jun 21, 2016 7:35 pm

Re: check if an item has an accesible name

Post by mander95 » Wed Jul 13, 2016 8:24 pm

That function just accesses the accessible name, I want to prove whether or not an item has an accessible name

User avatar
N612
Posts: 135
Joined: Mon Jul 11, 2016 4:01 pm

Re: check if an item has an accesible name

Post by N612 » Wed Jul 13, 2016 8:44 pm

Try this:

Code: Select all

if(repoItem.Element.GetAttributeValue("accessiblename") == null)
            	throw new Exception();

mander95
Posts: 58
Joined: Tue Jun 21, 2016 7:35 pm

Re: check if an item has an accesible name

Post by mander95 » Wed Jul 13, 2016 9:45 pm

thank you