Page 1 of 1

How to retrieve attribute value

Posted: Thu Jan 22, 2015 2:52 am
by guptaravi2k
Hi,

I am trying to retrieve value of InnetText from a repository element. (C#)

I have a repo element and its xpath looks is this:
/dom[@domain='10.31.160.99:6010']//div[#'ScrollPane#3']/div[2]/div/div[1]/div[4]/span[@innertext='22295505']

In UserCode file I want to retrieve value of innertext field and pass it on to a different function that perform further tests.

I am looking for API which does something like:
String value = Ranorex.GetAttribute(repo.ICMUAT.SpanTag22295505Info, "InnerText");

I am from java background so pls don't mind syntax.

Regards,
Ravi

Re: How to retrieve attribute value

Posted: Thu Jan 22, 2015 8:47 am
by odklizec
Hi,

The code you are looking for looks like this:

Code: Select all

string strValue = repo.ICMUAT.SpanTag22295505Info.GetAttributeValueText("InnerText");
BTW, if you are not sure how to create some code, you can always record an action or manually add an action to the recording table (see the list of available actions > here <) and then convert the selected action (or even multiple actions) into user code. Just right click the selected action(s) and from the appeared menu select "Convert to User Code". In this way you can quickly learn the code behind basic actions or even rapid prototyping things, even without a deep knowledge of coding ;)

Hope this helps?