Get position of substring in Windows in Ranorex.Text

Ask general questions here.
shinythomas
Posts: 2
Joined: Tue Nov 03, 2020 5:29 am

Get position of substring in Windows in Ranorex.Text

Post by shinythomas » Tue Nov 10, 2020 1:29 pm

I want to move the mouse cursor to a particular text position in Ranorex Text control.
Type of my control is Ranorex Text-
When a automated class is created the mouse cursor should go to any text line which is inside the class.
Attachments
RanorexTextfile.PNG
RanorexTextfile.PNG (22.71 KiB) Viewed 215 times

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

Re: Get position of substring in Windows in Ranorex.Text

Post by odklizec » Wed Nov 11, 2020 9:02 am

Hi,

It should be relative easy, to get a position (index) of substring in a string, using IndexOf method:
https://www.dotnetperls.com/indexof
As for setting cursor to given position of the substring, well, this will be completely different story. And I'm afraid, I don't have any sample for this. I think that you will somehow get the x/y screen position of required substring and then move the mouse to that position and finally click there to set the cursor at given place. I think it's impossible to provide better steps, or even sample code, without seeing the app under test or demo app, featuring text input 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