cancel
Showing results for 
Search instead for 
Did you mean: 

Testcomplete parsing an on screen value

SOLVED
Alleyn
Occasional Contributor

Testcomplete parsing an on screen value

Hi, is it possible to parse an on screen value in test complete?

 

Scenario: screen captures the following in one field 2021\6756 - I store this in Variable "Case no"

I then want to use the variable in a search screen but the search screen has the two values split up into "Year" and "Number"

 

What is the best approach to allow me to make use of the "Case No" variable so I can carry out my search?

 

Many thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Alleyn
Occasional Contributor

Re: Testcomplete parsing an on screen value

Hi @ebarbera 

 

Thanks for giving me a steer in the right direction.

I used the below - it was the Project.Variables.CaseNo that was throwing me. I can now manipulate the values as per your earlier post - thanks again!

def GetCaseNo():

Str = Project.Variables.CaseNo

# Uses the SubString method
Log.Message(aqString.SubString(Str, 0, 4))
Log.Message(aqString.SubString(Str, 5, 4))

View solution in original post

6 REPLIES 6
ebarbera
Staff

Re: Testcomplete parsing an on screen value

Hi @Alleyn - 

 

I would suggest using the aqString.SubString method. You can pass in your on screen value as the Input string and then specify the portion of the string you want to store into a variable. Create a persistent project level variable and then use this approach to store your value into the variable - from there you will be able to use it elsewhere in your test to search. 

 

https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqstring/substring.html#_g...

 

If you are not familiar with scripting there are examples in this document. 

 

Let me know if you have any questions.

Emma

Alleyn
Occasional Contributor

Re: Testcomplete parsing an on screen value

Hi @ebarbera 

 

Many thanks for taking the time to reply. It is much appreciated.

 

I guess the area I'm confused about its how to pass in the on screen value to a script. Once I get it into the script I should be fine - I think!

 

Kind regards,

Alleyn

ebarbera
Staff

Re: Testcomplete parsing an on screen value

Hi @Alleyn - 

 

My apologies! You can use the Set Variable Value operation if you are using keyword testing.

 

https://support.smartbear.com/testcomplete/docs/keyword-testing/reference/statements/set-variable-va... 

Here is a video (looks outdated but the same concept still applies in the new versions of TestComplete):

https://support.smartbear.com/testcomplete/videos/how-to-get-a-value-from-on-screen-and-store-it-for...

 

Let me know if you have any other questions. 

 

Emma

 

 

Alleyn
Occasional Contributor

Re: Testcomplete parsing an on screen value

Hi @ebarbera

 

Many thanks for that! I'll go and delve into the below and hopefully I'll get through this problem.

 

Thanks again,

Alleyn

Alleyn
Occasional Contributor

Re: Testcomplete parsing an on screen value

Hi @ebarbera 

 

Thanks for giving me a steer in the right direction.

I used the below - it was the Project.Variables.CaseNo that was throwing me. I can now manipulate the values as per your earlier post - thanks again!

def GetCaseNo():

Str = Project.Variables.CaseNo

# Uses the SubString method
Log.Message(aqString.SubString(Str, 0, 4))
Log.Message(aqString.SubString(Str, 5, 4))

View solution in original post

ebarbera
Staff

Re: Testcomplete parsing an on screen value

Hi @Alleyn -

 

That looks great - glad I could help!

 

Emma

New Here?
Join us and watch the welcome video:
Announcements