Get InnerText of element

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
boris0dev
Posts: 17
Joined: Fri Nov 09, 2018 10:28 am

Get InnerText of element

Post by boris0dev » Fri Nov 09, 2018 10:41 am

I've created a user code method:

 
        public void IsValueNumberInRange(RepoItemInfo element, int start, int end)
        {
        	System.Diagnostics.Debug.WriteLine("Value of the element " + element.ToString());
        }
I'm calling the user code in my recording and select as RepoItemInfo an arbitrary repository item.
Capto_Capture 2018-11-09_11-29-43_AM.png
Problem: I want to get the InnerText of the element.
How can I achieve this?

Thanks for your help
You do not have the required permissions to view the files attached to this post.

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

Re: Get InnerText of element

Post by odklizec » Fri Nov 09, 2018 12:08 pm

Hi,

Try something like this:
string elementStringVal = element.CreateAdapter<Unknown>().Element.GetAttributeValueText("InnerText").ToString();
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

boris0dev
Posts: 17
Joined: Fri Nov 09, 2018 10:28 am

Re: Get InnerText of element

Post by boris0dev » Fri Nov 09, 2018 12:59 pm

Thanks, this was the solution, except that CreateAdapter<Unknown>() expects at least 1 argument (bool)

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

Re: Get InnerText of element

Post by odklizec » Fri Nov 09, 2018 1:02 pm

Hi,

Yes, you are right! I wrote it from memory and forgot about bool parameter ;)
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