Ask a Question

how to select the random list from lslist table. it is string values

GAutomation
Frequent Contributor

how to select the random list from lslist table. it is string values

Function Selectvalue()
if Trim(UCASE(curobj.Exists))= "TRUE" then
Set recgText = OCR.Recognize.curobj
If recgText.BlockCount > 0 Then
Log.AppendFolder("Recognized text by blocks")
For i = 0 To int(recgText.FullText)
Randomize
Log.Message(recg.Block(i).Click)
Next
Log.PopLogFolder
End If
End Function
 
 
 
It gives me cannot convert string value. i want to select a random value from the listtable.
14 REPLIES 14
Marsha_R
Community Hero

Which line of code gives the error message?  


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
GAutomation
Frequent Contributor

For loop line where i am trying to convert string to int. This trying thru OCR. is there any other way we can select a random value from list table. in the properties there is no witem or itemlist for me to loop thru.

Try the aqConvert StrToInt

https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqconvert/methods.html


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
GAutomation
Frequent Contributor

Attached is the screen and the whole list is considered as 1 text file. so ima not able to select a randon string value.

Then I'm not sure why converting the list string to an integer would do you any good at all.

 

What will the test do once it has a list item to work with?  Perhaps there's a another way to move forward.

 

 


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame

Well, first of all

 

1) You can't convert ANY of that to an integer if each line in the file is one of the elements.  It's not an integer value so you will ALWAYS get an error

2) If you want to use each row as a particular item, probably what would be better would be to download the contents to something like a CSV file or read the text in as a text string with delimiters on the carriage return.  You can the work with it using the aqString object and the methods for delimited strings.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Hi,

 

If I got the problem and the screenshot right, then you seem to have a property (FullTExt) that is a text splitted to several lines. So why not to count the number of lines, get a random number in the [1...NofLines] range and select the line by that number?

Does this help?

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
GAutomation
Frequent Contributor

Alex,

I tried with curobject.highlight.fulltext.Linescount but the lines count method is not working. Will u be able to give me a sample code.

Hi,

 

> curobject.highlight.fulltext.Linescount

Is .linescount a property that you see in the Object Browser/Object Spy for the target object?

 

I would recommend to try something like this:

aqString.GetListLength(<object>.FullText)

See documentation for more details about this and other methods of the aqString object.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
cancel
Showing results for 
Search instead for 
Did you mean: