How to verify that the text is available in the text field

Ask general questions here.
premravi
Posts: 69
Joined: Tue Jan 08, 2019 1:55 pm

How to verify that the text is available in the text field

Post by premravi » Mon Apr 01, 2019 4:23 pm

Hi,

Please help me to understand how to identify whether the text is available in the field or not
for e.g. if some value is entered in Username field ---- How to identify and say "YES" the value is available in the field

Regards

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

Re: How to verify that the text is available in the text field

Post by odklizec » Tue Apr 02, 2019 7:33 am

Hi,

You can find a very detailed explanation of Ranorex validation and its usage in Ranorex help. Check for example this text-based validation example:
https://www.ranorex.com/help/latest/ran ... n-example/
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

McTurtle
Posts: 255
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: How to verify that the text is available in the text field

Post by McTurtle » Tue Apr 02, 2019 7:36 am

Hi premravi,

Use Validation actions, like odklizec said. For example, for Notepad:
TextExists.png
TextExists.png (25.31 KiB) Viewed 155 times
Regards,
McTurtle

premravi
Posts: 69
Joined: Tue Jan 08, 2019 1:55 pm

Re: How to verify that the text is available in the text field

Post by premravi » Wed Apr 03, 2019 10:38 am

Hi,

Thanks a lot for the resolution
but the text is inside innertext
Moreover the innertext is changing in every run
So we have to read the text/validate the text in the run time

Please let me know if more info is required

Regards

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

Re: How to verify that the text is available in the text field

Post by odklizec » Wed Apr 03, 2019 11:46 am

Hi,

I think your first problem is, that you don’t know, how to recognise an element, which InnerText is changing? Could you please upload a Ranorex snapshot (NOT screenshot) of the element in question.

If there is no other usable attribute, which would help with element identification, then you will most probably somehow match the element using another element available in the UI (for example a label, describing the purpose of element you would like to validate) and then traverse from such element to your desired one. Unfortunately, without snapshot, there is bot much anyone here can do for you in this matter. So please create and post the snapshot. Thanks.
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

premravi
Posts: 69
Joined: Tue Jan 08, 2019 1:55 pm

Re: How to verify that the text is available in the text field

Post by premravi » Fri Apr 05, 2019 2:07 pm

Hi,

Thanks a lot for you reply,

I will try to be more specific with my query this time

Actually the scenario - I have to track a value list ("Div View Port List")first inside that list I have to select (click) the first row

Please help me to know how can I achieve it

Please find the attached snapshot of the respective repository item

Regards
Attachments
ViewPortListSnapshot.rxsnp
(106.22 KiB) Downloaded 8 times

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

Re: How to verify that the text is available in the text field

Post by odklizec » Mon Apr 08, 2019 11:39 am

Hi,

Well, without seeing the UI in action, it's hard to tell what exactly should be clicked/selected in the first row? :) The problem is, that each row contains multiple elements. And there is nothing like "select/click entire row". You will most probably have to specify, which element in the row should be clicked, to make the entire row selected?

So here is the xpath for first 'name' element in first row:
/dom[@domain='dashboard.eu-iport.nielsen-iwatch.com.aws-w-np.nielsencsp.com']//div[@class='viewport-list']//div[@class~'mj-grid-row'][1]/div[@class~'mj-grid-cell name']
Where this specifies first row...

Code: Select all

div[@class~'mj-grid-row'][1]
And this specifies cell with called 'name' in the row...

Code: Select all

div[@class~'mj-grid-cell name']
Hope this helps?
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

premravi
Posts: 69
Joined: Tue Jan 08, 2019 1:55 pm

Re: How to verify that the text is available in the text field

Post by premravi » Tue Apr 09, 2019 12:17 pm

Hi Pavel,

Thanks a lot for your resolution,

It really helps, I am able to click on the specific part in the first row

But now if I am trying get the text of that specific part in the first row, it is returning the text of the 2nd row

This is piece of code I am using to get the text and storing it into a string type variable

string FirstiPortName = iPortrepo.IPort.MyIPorts.btn_FirstIportText.Element.GetAttributeValueText("innertext");
Report.Success(FirstiPortName);

Why it is returning the text of the second row I am not getting

Please help me in this issue

Regards

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

Re: How to verify that the text is available in the text field

Post by odklizec » Wed Apr 10, 2019 7:19 am

Hi,

Unfortunately, without seeing the xpath behind the repo element iPortrepo.IPort.MyIPorts.btn_FirstIportText, it's impossible to tell what's wrong? Could you please post the xpath (full xpath please)?
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

premravi
Posts: 69
Joined: Tue Jan 08, 2019 1:55 pm

Re: How to verify that the text is available in the text field

Post by premravi » Wed Apr 10, 2019 11:30 am

Hi,

My application needs a refresh to actually have that newly created row available in the drop down

So, I injected one "click refresh" step prior to get the text and then it is working fine

Thanks a lot for your help and guidance

Regards

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

Re: How to verify that the text is available in the text field

Post by odklizec » Wed Apr 10, 2019 11:41 am

Hi,

You are welcome. Good to hear you solved the problem ;)
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

premravi
Posts: 69
Joined: Tue Jan 08, 2019 1:55 pm

Re: How to verify that the text is available in the text field

Post by premravi » Thu Apr 11, 2019 12:39 pm

Hi,

Without you, it will not be possible :)

Regards