convert string to text to use CAPTION

Class library usage, coding and language questions.
tiara
Posts: 16
Joined: Thu Jun 20, 2013 3:03 pm

convert string to text to use CAPTION

Post by tiara » Thu Jul 11, 2013 10:52 pm

Hey
I want to convert my string value to text value as i want to use caption method on it.. how can i do that in ranorex....

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: convert string to text to use CAPTION

Post by Support Team » Fri Jul 12, 2013 2:18 pm

Hello,

Could you please be more specific what you want to do and why do you want to convert a string to a text value?
You can, e.g. create a Text adapter. Please read the section "Ranorex UI Adapter" or "Create Adapters to Access More Properties and Methods" in order to get more information how to create adapters in Ranorex.
Thank you!

Regards,
Bernhard
.
Image

tiara
Posts: 16
Joined: Thu Jun 20, 2013 3:03 pm

Re: convert string to text to use CAPTION

Post by tiara » Fri Jul 12, 2013 4:37 pm

Hey Bernhard
I read the adapter page but I am not pretty sure what is an adapter for.... can i make an adapter text to which i can pass a string such that i can use my string variable to give caption.....

My piece of code in vb.net takes is supposed to compare my backend string with the values in my repository. but when i am using
For i As Integer = 0 to arr.length-1
For j As integer = 1 to 100
Dim books As Text
books = "MyRepo.ComCompin.LeftSlideView.book"+Cstr(j)
System.console.writeline(books)
If books = arr(i) Then
System.console.writeline("Books exists")
End if



Its is giving me an error saying that " No element found for path myrepo.comcompin.leftslideview.book1 within 10 sec"

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: convert string to text to use CAPTION

Post by Support Team » Tue Jul 16, 2013 4:37 pm

Hi Tiara,

It seems that you mixed up different things. A Ranorex.Text represents a Text control of your application and is not just a string. If you want to compare the text of the repo item "book" you have to compare the specific text attribute of that item with your string and not with the full object.
Could you describe in detail what you are trying to do, do you want to check if different elements of your application exist? Could you illustrate it with some screenshots?
Could you also post a Ranorex snapshot of that "book" element?
Following link will show you how to generate a snapshot file: Creating Ranorex Snapshot Files.

Thanks,
Markus
.
Image