Ask a Question

String Comparion in Code Expression for Keyword Test within Visual Basic project suite

Senior Member

String Comparion in Code Expression for Keyword Test within Visual Basic project suite

RESOLVED:  When using in the IF ... THEN Keyword test statement, must be Code expression with double quote mark before and after the string when not in a variable.


In a Keyword test after setting a variable with data from the page page, I'd like to know if that variable contains

"error", or "blocked" or "can't" or "unauthorized".

In the Set Variable or IF...THEN statements can choose Code Expression, but

For example, this one works:  REPLACE(KeywordTests.Tour_Lowest_Price.Variables.Lowest_Price, "$", "")

But these don't"

aqString.FIND(ProjectSuite.Variables.Browser_Tab_Title,"not exist",1)

FIND(ProjectSuite.Variables.Browser_Tab_Title,"not exist",1),

INSTR(ProjectSuite.Variables.Browser_Tab_Title,"not exist",1)


Is there a list of supported visual basic string functions to be used via the Code Expression field.


Esteemed Contributor

aqString.Find should work as a code expression.  Keep in mind, it returns an integer value that if it's a value of anything other than -1, the string is found.  So, you need to make sure you build your logic in the keyword test appropriately.


If you can provide a screenshot of what you have implemented, we can help you figure out what's missing.

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
Showing results for 
Search instead for 
Did you mean: